org.apache.commons.collections.bidimap.DualHashBidiMap Java Examples
The following examples show how to use
org.apache.commons.collections.bidimap.DualHashBidiMap.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AccountingLineViewField.java From kfs with GNU Affero General Public License v3.0 | 6 votes |
/** * parse the given lookup parameter string into a bidirectinal map * * @param lookupParameters the lookup parameter string * @param accountingLinePrefix the actual accounting line prefix * @return a bidirectinal map that holds all the given lookup parameters */ private BidiMap buildBidirecionalMapFromParameters(String parameters, String accountingLinePrefix) { BidiMap parameterMap = new DualHashBidiMap(); // if we didnt get any incoming parameters, then just return an empty parameterMap if (StringUtils.isBlank(parameters)) { return parameterMap; } String[] parameterArray = StringUtils.split(parameters, KFSConstants.FIELD_CONVERSIONS_SEPERATOR); for (String parameter : parameterArray) { String[] entrySet = StringUtils.split(parameter, KFSConstants.FIELD_CONVERSION_PAIR_SEPERATOR); if (entrySet != null) { String parameterKey = escapeAccountingLineName(entrySet[0], accountingLinePrefix); String parameterValue = escapeAccountingLineName(entrySet[1], accountingLinePrefix); parameterMap.put(parameterKey, parameterValue); } } return parameterMap; }
Example #2
Source File: ReverseMapLookup.java From levelup-java-examples with Apache License 2.0 | 6 votes |
@Test public void flip_map_entries_with_apachecommons() { BidiMap stateCodeToDescription = new DualHashBidiMap(); stateCodeToDescription.put("WI", "Wisconsin"); stateCodeToDescription.put("MN", "Minnesota"); stateCodeToDescription.put("FL", "Florida"); stateCodeToDescription.put("IA", "Iowa"); stateCodeToDescription.put("OH", "Ohio"); BidiMap descriptionToStateCode = stateCodeToDescription .inverseBidiMap(); logger.info(descriptionToStateCode); assertEquals("IA", descriptionToStateCode.get("Iowa")); }
Example #3
Source File: PUB.java From proparse with Eclipse Public License 2.0 | 5 votes |
/** It's possible, maybe even sensible, to reuse a PUB object. * This method clears out old lists in preparation for reloading or rebuilding. */ private void _refresh() { exportList = new ArrayList<SymbolRef>(); fileList = new ArrayList<String>(); fileIndexes = new IntegerIndex<String>(); importList = new ArrayList<SymbolRef>(); tableMap = new TreeMap<String, TableRef>(); stringTable = new DualHashBidiMap(); /* String index zero is not used. * This allows us to use 0 from JPNode.attrGet() to indicate "no string value present". */ stringIndex(""); }
Example #4
Source File: SimilarityWordConfiguration.java From wandora with GNU General Public License v3.0 | 4 votes |
SimilarityWordConfiguration() { super(); setAssociateScore(true); THRESHOLD = 0.5f; STRING_METRICS = new DualHashBidiMap(); STRING_METRICS.put("Levenshtein", new Levenshtein()); STRING_METRICS.put("Jaro", new Jaro()); STRING_METRICS.put("Jaro Winkler", new JaroWinkler()); STRING_METRIC = new Levenshtein(); }