Java Utililty Methods AbstractMap Usage

List of utility methods to do AbstractMap Usage

Description

The list of methods to do AbstractMap Usage are organized into topic(s).

Method

Map.Entry>buildClause(String key, String... values)
build Clause
List<String> clauseValues = new ArrayList<String>();
if (values != null) {
    for (String value : values) {
        clauseValues.add(value);
} else {
    clauseValues.add(null);
return new AbstractMap.SimpleEntry<String, List<String>>(key, clauseValues);
Map.EntrycountLinesColumns(String text, int initialLinesCnt, int initialColumnsCnt)
Count lines and columns (in last line) in text.
int lines = initialLinesCnt;
int columns = initialColumnsCnt;
boolean foundCr = false;
for (char c : text.toCharArray()) {
    if (c == '\n') {
        foundCr = false;
        lines++;
        columns = 0;
...
Map.EntrydecodeIconUrl(String path)
Decodes an URL path to extract a name and a potential qualifier.
if (path.startsWith("/"))
    path = path.substring(1);
String name = null, qualifier = null;
String[] parts = path.split("/");
switch (parts.length) {
case 2:
    name = parts[0];
    break;
...
intgetClassType(Object obj)
get Class Type
Class<?> collection = java.util.AbstractCollection.class;
Class<?> map = java.util.AbstractMap.class;
if (collection.isInstance(obj)) {
    return 1;
} else if (map.isInstance(obj)) {
    return 2;
} else {
    return 0;
...
Map>getSymmetricPropertyValueDifference( Properties propertyFileOne, Properties propertyFileTwo)
get Symmetric Property Value Difference
Map<String, SimpleEntry<String, String>> differences = new HashMap<String, SimpleEntry<String, String>>();
for (String key : propertyFileOne.stringPropertyNames()) {
    String propertyOneValue = propertyFileOne.getProperty(key);
    String propertyTwoValue = propertyFileTwo.getProperty(key);
    if (propertyOneValue != null && propertyTwoValue != null
            && !propertyOneValue.equals(propertyTwoValue)) {
        differences.put(key, new SimpleEntry(propertyOneValue, propertyTwoValue));
return differences;
Map.EntryparseEntityURI(final String uri)
parse Entity URI
final String relPath = uri.substring(uri.lastIndexOf("/"));
final int branchIndex = relPath.indexOf('(');
final String es = relPath.substring(0, branchIndex);
final String eid = relPath.substring(branchIndex + 1, relPath.indexOf(')'));
return new SimpleEntry<String, String>(es, eid);
Map.EntryparseExportedVariable(String exportedVariable)
Parses an exported variable (<variableName> = <defaultValue>).
int index = exportedVariable.indexOf('=');
String varName = exportedVariable, defaultValue = null;
if (index > 0) {
    varName = exportedVariable.substring(0, index).trim();
    defaultValue = exportedVariable.substring(index + 1).trim();
return new AbstractMap.SimpleEntry<String, String>(varName, defaultValue);
Map.EntryparseSocketAddress(String address)
parse Socket Address
String hostName = null;
Integer port = null;
if (null != address) {
    if (-1 != address.indexOf(':')) {
        String[] split = address.split(":");
        hostName = split[0];
        port = Integer.valueOf(split[1]);
    } else {
...
Map.EntryparseVariableName(String variableName)
Parses a variable name (<facetOrComponentName>.<simpleName>).
String componentOrFacetName = "", simpleName = variableName;
int index = variableName.indexOf('.');
if (index >= 0) {
    componentOrFacetName = variableName.substring(0, index).trim();
    simpleName = variableName.substring(index + 1).trim();
return new AbstractMap.SimpleEntry<String, String>(componentOrFacetName, simpleName);
EntrysplitByQualifier(String str)
split By Qualifier
int i = str.lastIndexOf(':');
String name = i == -1 ? str : str.substring(0, i).trim();
String qualifier = i == -1 ? "" : str.substring(i + 1).trim();
Entry<String, String> result = new AbstractMap.SimpleEntry<String, String>(name, qualifier);
return result;