Java Utililty Methods SortedMap Usage

List of utility methods to do SortedMap Usage

  1. HOME
  2. Java
  3. S
  4. SortedMap Usage

Description

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

Method

long computeByteSizeM(SortedMap byteSizeByName)
Computes total byte size.
long totalByteSize = 0;
for (Long byteSize : byteSizeByName.values()) {
 totalByteSize += byteSize.longValue();
return totalByteSize;
List computePathCauselessLms( List>> depCausesByNameList)
Removes the causes.
final List<String> nameList = new ArrayList<String>();
final int size = depCausesByNameList.size();
for (int i = 0; i < size; i++) {
 final SortedMap<String, SortedSet<String>> depCausesByName = depCausesByNameList.get(i);
 if (depCausesByName.size() != 1) {
 throw new IllegalArgumentException("map size must be 1, but map is " + depCausesByName);
 final String name = depCausesByName.firstKey();
...
SortedMap filterPrefix(SortedMap baseMap, String prefix)
filter Prefix
if (prefix.length() > 0) {
 char nextLetter = (char) (prefix.charAt(prefix.length() - 1) + 1);
 String end = prefix.substring(0, prefix.length() - 1) + nextLetter;
 return baseMap.subMap(prefix, end);
return baseMap;
SortedMap find(SortedMap map, String baseName)
find
return map.subMap(baseName, baseName.concat("\uFFFF"));
T firstElement(Collection c)
first Element
if (c == null || c.size() == 0) {
 return null;
} else {
 return c.iterator().next();
T firstElement(Collection c)
first Element
if (isEmpty(c)) {
 return null;
return c.iterator().next();
String generatePropertiesFilter(SortedMap propertiesMap)
Generate a Filter as a String given a Map of property/value pairs.
if (propertiesMap.size() == 1) {
 return "(" + propertiesMap.firstKey() + "=" + propertiesMap.get(propertiesMap.firstKey()) + ")";
} else if (propertiesMap.size() > 1) {
 return "(&"
 + generatePropertiesFilter(
 propertiesMap.subMap(propertiesMap.firstKey(), propertiesMap.firstKey() + "0円"))
 + generatePropertiesFilter(propertiesMap.tailMap(propertiesMap.firstKey() + "0円")) + ")";
return "";
List getAll(SortedMap map)
Given a sorted map with integer keys and entries of type T[] , this method returns a list of all entries of type T in the induced ordering.
List<T> array = new ArrayList<T>();
for (int i : map.keySet()) {
 T[] entry = map.get(i);
 for (T t : entry) {
 array.add(t);
return array;
...
U getObjectSortedMap(SortedMap map, T key)
get Object Sorted Map
if (map == null) {
 return null;
return map.get(key);
boolean isCollectionClass(Class clazz)
is Collection Class
return clazz == Collection.class || clazz == java.util.List.class || clazz == java.util.Set.class
 || clazz == java.util.Map.class || clazz == java.util.SortedSet.class 
 || clazz == java.util.SortedMap.class; 


AltStyle によって変換されたページ (->オリジナル) /