Tabnine Logo
MapUtils
Code IndexAdd Tabnine to your IDE (free)

How to use
MapUtils
in
org.apache.hbase.thirdparty.org.apache.commons.collections4

Best Java code snippets using org.apache.hbase.thirdparty.org.apache.commons.collections4.MapUtils (Showing top 20 results out of 315)

origin: apache/hbase

void filterCellByStore(Entry logEntry) {
 Map<byte[], Long> maxSeqIdInStores =
   regionMaxSeqIdInStores.get(Bytes.toString(logEntry.getKey().getEncodedRegionName()));
 if (MapUtils.isEmpty(maxSeqIdInStores)) {
  return;
 }
 // Create the array list for the cells that aren't filtered.
 // We make the assumption that most cells will be kept.
 ArrayList<Cell> keptCells = new ArrayList<>(logEntry.getEdit().getCells().size());
 for (Cell cell : logEntry.getEdit().getCells()) {
  if (CellUtil.matchingFamily(cell, WALEdit.METAFAMILY)) {
   keptCells.add(cell);
  } else {
   byte[] family = CellUtil.cloneFamily(cell);
   Long maxSeqId = maxSeqIdInStores.get(family);
   // Do not skip cell even if maxSeqId is null. Maybe we are in a rolling upgrade,
   // or the master was crashed before and we can not get the information.
   if (maxSeqId == null || maxSeqId.longValue() < logEntry.getKey().getSequenceId()) {
    keptCells.add(cell);
   }
  }
 }
 // Anything in the keptCells array list is still live.
 // So rather than removing the cells from the array list
 // which would be an O(n^2) operation, we just replace the list
 logEntry.getEdit().setCells(keptCells);
}
origin: apache/hbase

if (MapUtils.isNotEmpty(colFamTimeRangeMap)) {
 for (Map.Entry<ByteBuffer, TTimeRange> entry : colFamTimeRangeMap.entrySet()) {
  out.setColumnFamilyTimeRange(Bytes.toBytes(entry.getKey()),
origin: org.apache.hbase.thirdparty/hbase-shaded-miscellaneous

/**
 * Looks up the given key in the given map, converting the result into
 * a number, using the default value if the the conversion fails.
 *
 * @param <K>  the key type
 * @param map  the map whose value to look up
 * @param key  the key of the value to look up in that map
 * @param defaultValue  what to return if the value is null or if the
 *   conversion fails
 * @return  the value in the map as a number, or defaultValue if the
 *   original value is null, the map is null or the number conversion fails
 */
public static <K> Number getNumber(final Map<? super K, ?> map, final K key, final Number defaultValue) {
  Number answer = getNumber(map, key);
  if (answer == null) {
    answer = defaultValue;
  }
  return answer;
}
origin: org.apache.hbase.thirdparty/hbase-shaded-miscellaneous

/**
 * Looks up the given key in the given map, converting the result into
 * a double, using the default value if the the conversion fails.
 *
 * @param <K>  the key type
 * @param map  the map whose value to look up
 * @param key  the key of the value to look up in that map
 * @param defaultValue  what to return if the value is null or if the
 *   conversion fails
 * @return  the value in the map as a number, or defaultValue if the
 *   original value is null, the map is null or the number conversion fails
 */
public static <K> Double getDouble(final Map<? super K, ?> map, final K key, final Double defaultValue) {
  Double answer = getDouble(map, key);
  if (answer == null) {
    answer = defaultValue;
  }
  return answer;
}
origin: org.apache.hbase.thirdparty/hbase-shaded-miscellaneous

/**
 * Looks up the given key in the given map, converting the result into
 * an integer, using the default value if the the conversion fails.
 *
 * @param <K>  the key type
 * @param map  the map whose value to look up
 * @param key  the key of the value to look up in that map
 * @param defaultValue  what to return if the value is null or if the
 *   conversion fails
 * @return  the value in the map as a number, or defaultValue if the
 *   original value is null, the map is null or the number conversion fails
 */
public static <K> Integer getInteger(final Map<? super K, ?> map, final K key, final Integer defaultValue) {
  Integer answer = getInteger(map, key);
  if (answer == null) {
    answer = defaultValue;
  }
  return answer;
}
origin: org.apache.hbase.thirdparty/hbase-shaded-miscellaneous

/**
 * Looks up the given key in the given map, converting the result into
 * a float, using the default value if the the conversion fails.
 *
 * @param <K>  the key type
 * @param map  the map whose value to look up
 * @param key  the key of the value to look up in that map
 * @param defaultValue  what to return if the value is null or if the
 *   conversion fails
 * @return  the value in the map as a number, or defaultValue if the
 *   original value is null, the map is null or the number conversion fails
 */
public static <K> Float getFloat(final Map<? super K, ?> map, final K key, final Float defaultValue) {
  Float answer = getFloat(map, key);
  if (answer == null) {
    answer = defaultValue;
  }
  return answer;
}
origin: org.apache.hbase.thirdparty/hbase-shaded-miscellaneous

/**
 * Looks up the given key in the given map, converting the result into
 * a long, using the default value if the the conversion fails.
 *
 * @param <K>  the key type
 * @param map  the map whose value to look up
 * @param key  the key of the value to look up in that map
 * @param defaultValue  what to return if the value is null or if the
 *   conversion fails
 * @return  the value in the map as a number, or defaultValue if the
 *   original value is null, the map is null or the number conversion fails
 */
public static <K> Long getLong(final Map<? super K, ?> map, final K key, final Long defaultValue) {
  Long answer = getLong(map, key);
  if (answer == null) {
    answer = defaultValue;
  }
  return answer;
}
origin: org.apache.hbase.thirdparty/hbase-shaded-miscellaneous

/**
 * Looks up the given key in the given map, converting the result into
 * a byte, using the default value if the the conversion fails.
 *
 * @param <K>  the key type
 * @param map  the map whose value to look up
 * @param key  the key of the value to look up in that map
 * @param defaultValue  what to return if the value is null or if the
 *   conversion fails
 * @return  the value in the map as a number, or defaultValue if the
 *   original value is null, the map is null or the number conversion fails
 */
public static <K> Byte getByte(final Map<? super K, ?> map, final K key, final Byte defaultValue) {
  Byte answer = getByte(map, key);
  if (answer == null) {
    answer = defaultValue;
  }
  return answer;
}
origin: org.apache.hbase.thirdparty/hbase-shaded-miscellaneous

/**
 * Looks up the given key in the given map, converting the result into
 * a boolean, using the default value if the the conversion fails.
 *
 * @param <K>  the key type
 * @param map  the map whose value to look up
 * @param key  the key of the value to look up in that map
 * @param defaultValue  what to return if the value is null or if the
 *   conversion fails
 * @return  the value in the map as a boolean, or defaultValue if the
 *   original value is null, the map is null or the boolean conversion fails
 */
public static <K> Boolean getBoolean(final Map<? super K, ?> map, final K key, final Boolean defaultValue) {
  Boolean answer = getBoolean(map, key);
  if (answer == null) {
    answer = defaultValue;
  }
  return answer;
}
origin: org.apache.hbase.thirdparty/hbase-shaded-miscellaneous

/**
 * Looks up the given key in the given map, converting the result into
 * a map, using the default value if the the conversion fails.
 *
 * @param <K>  the key type
 * @param map  the map whose value to look up
 * @param key  the key of the value to look up in that map
 * @param defaultValue  what to return if the value is null or if the
 *   conversion fails
 * @return  the value in the map as a number, or defaultValue if the
 *   original value is null, the map is null or the map conversion fails
 */
public static <K> Map<?, ?> getMap(final Map<? super K, ?> map, final K key, final Map<?, ?> defaultValue) {
  Map<?, ?> answer = getMap(map, key);
  if (answer == null) {
    answer = defaultValue;
  }
  return answer;
}
origin: org.apache.hbase.thirdparty/hbase-shaded-miscellaneous

/**
 * Gets a Byte from a Map in a null-safe manner.
 * <p>
 * The Byte is obtained from the results of {@link #getNumber(Map,Object)}.
 *
 * @param <K>  the key type
 * @param map  the map to use
 * @param key  the key to look up
 * @return the value in the Map as a Byte, <code>null</code> if null map input
 */
public static <K> Byte getByte(final Map<? super K, ?> map, final K key) {
  final Number answer = getNumber(map, key);
  if (answer == null) {
    return null;
  }
  if (answer instanceof Byte) {
    return (Byte) answer;
  }
  return Byte.valueOf(answer.byteValue());
}
origin: org.apache.hbase.thirdparty/hbase-shaded-miscellaneous

/**
 * Gets a double from a Map in a null-safe manner.
 * <p>
 * The double is obtained from the results of {@link #getNumber(Map,Object)}.
 *
 * @param <K>  the key type
 * @param map  the map to use
 * @param key  the key to look up
 * @return the value in the Map as a double, <code>0.0</code> if null map input
 */
public static <K> double getDoubleValue(final Map<? super K, ?> map, final K key) {
  final Double doubleObject = getDouble(map, key);
  if (doubleObject == null) {
    return 0d;
  }
  return doubleObject.doubleValue();
}
origin: org.apache.hbase.thirdparty/hbase-shaded-miscellaneous

/**
 * Gets an int from a Map in a null-safe manner.
 * <p>
 * The int is obtained from the results of {@link #getNumber(Map,Object)}.
 *
 * @param <K>  the key type
 * @param map  the map to use
 * @param key  the key to look up
 * @return the value in the Map as an int, <code>0</code> if null map input
 */
public static <K> int getIntValue(final Map<? super K, ?> map, final K key) {
  final Integer integerObject = getInteger(map, key);
  if (integerObject == null) {
    return 0;
  }
  return integerObject.intValue();
}
origin: org.apache.hbase.thirdparty/hbase-shaded-miscellaneous

/**
 * Gets a float from a Map in a null-safe manner.
 * <p>
 * The float is obtained from the results of {@link #getNumber(Map,Object)}.
 *
 * @param <K>  the key type
 * @param map  the map to use
 * @param key  the key to look up
 * @return the value in the Map as a float, <code>0.0F</code> if null map input
 */
public static <K> float getFloatValue(final Map<? super K, ?> map, final K key) {
  final Float floatObject = getFloat(map, key);
  if (floatObject == null) {
    return 0f;
  }
  return floatObject.floatValue();
}
origin: org.apache.hbase.thirdparty/hbase-shaded-miscellaneous

/**
 * Gets a long from a Map in a null-safe manner.
 * <p>
 * The long is obtained from the results of {@link #getNumber(Map,Object)}.
 *
 * @param <K>  the key type
 * @param map  the map to use
 * @param key  the key to look up
 * @return the value in the Map as a long, <code>0L</code> if null map input
 */
public static <K> long getLongValue(final Map<? super K, ?> map, final K key) {
  final Long longObject = getLong(map, key);
  if (longObject == null) {
    return 0L;
  }
  return longObject.longValue();
}
origin: org.apache.hbase.thirdparty/hbase-shaded-miscellaneous

/**
 * Gets a byte from a Map in a null-safe manner.
 * <p>
 * The byte is obtained from the results of {@link #getNumber(Map,Object)}.
 *
 * @param <K>  the key type
 * @param map  the map to use
 * @param key  the key to look up
 * @return the value in the Map as a byte, <code>0</code> if null map input
 */
public static <K> byte getByteValue(final Map<? super K, ?> map, final K key) {
  final Byte byteObject = getByte(map, key);
  if (byteObject == null) {
    return 0;
  }
  return byteObject.byteValue();
}
origin: org.apache.hbase.thirdparty/hbase-shaded-miscellaneous

/**
 * Gets a boolean from a Map in a null-safe manner.
 * <p>
 * If the value is a <code>Boolean</code> its value is returned.
 * If the value is a <code>String</code> and it equals 'true' ignoring case
 * then <code>true</code> is returned, otherwise <code>false</code>.
 * If the value is a <code>Number</code> an integer zero value returns
 * <code>false</code> and non-zero returns <code>true</code>.
 * Otherwise, <code>false</code> is returned.
 *
 * @param <K>  the key type
 * @param map  the map to use
 * @param key  the key to look up
 * @return the value in the Map as a Boolean, <code>false</code> if null map input
 */
public static <K> boolean getBooleanValue(final Map<? super K, ?> map, final K key) {
  return Boolean.TRUE.equals(getBoolean(map, key));
}
origin: com.aliyun.hbase/alihbase-thrift

if (MapUtils.isNotEmpty(colFamTimeRangeMap)) {
 for (Map.Entry<ByteBuffer, TTimeRange> entry : colFamTimeRangeMap.entrySet()) {
  out.setColumnFamilyTimeRange(Bytes.toBytes(entry.getKey()),
origin: org.apache.hbase.thirdparty/hbase-shaded-miscellaneous

/**
 * Null-safe check if the specified map is not empty.
 * <p>
 * Null returns false.
 *
 * @param map  the map to check, may be null
 * @return true if non-null and non-empty
 * @since 3.2
 */
public static boolean isNotEmpty(final Map<?,?> map) {
  return !MapUtils.isEmpty(map);
}
origin: org.apache.hbase.thirdparty/hbase-shaded-miscellaneous

/**
 * Gets a Long from a Map in a null-safe manner.
 * <p>
 * The Long is obtained from the results of {@link #getNumber(Map,Object)}.
 *
 * @param <K>  the key type
 * @param map  the map to use
 * @param key  the key to look up
 * @return the value in the Map as a Long, <code>null</code> if null map input
 */
public static <K> Long getLong(final Map<? super K, ?> map, final K key) {
  final Number answer = getNumber(map, key);
  if (answer == null) {
    return null;
  }
  if (answer instanceof Long) {
    return (Long) answer;
  }
  return Long.valueOf(answer.longValue());
}
org.apache.hbase.thirdparty.org.apache.commons.collections4MapUtils

Javadoc

Provides utility methods and decorators for Map and SortedMap instances.

It contains various type safe methods as well as other useful features like deep copying.

It also provides the following decorators:

  • #fixedSizeMap(Map)
  • #fixedSizeSortedMap(SortedMap)
  • #lazyMap(Map,Factory)
  • #lazyMap(Map,Transformer)
  • #lazySortedMap(SortedMap,Factory)
  • #lazySortedMap(SortedMap,Transformer)
  • #predicatedMap(Map,Predicate,Predicate)
  • #predicatedSortedMap(SortedMap,Predicate,Predicate)
  • #transformedMap(Map,Transformer,Transformer)
  • #transformedSortedMap(SortedMap,Transformer,Transformer)
  • #multiValueMap(Map)
  • #multiValueMap(Map,Class)
  • #multiValueMap(Map,Factory)

Most used methods

  • isEmpty
    Null-safe check if the specified map is empty. Null returns true.
  • isNotEmpty
    Null-safe check if the specified map is not empty. Null returns false.
  • getBoolean
    Looks up the given key in the given map, converting the result into a boolean, using the default val
  • getByte
    Looks up the given key in the given map, converting the result into a byte, using the default value
  • getDouble
    Looks up the given key in the given map, converting the result into a double, using the default valu
  • getFloat
    Looks up the given key in the given map, converting the result into a float, using the default value
  • getInteger
    Looks up the given key in the given map, converting the result into an integer, using the default va
  • getLong
    Looks up the given key in the given map, converting the result into a long, using the default value
  • getMap
    Looks up the given key in the given map, converting the result into a map, using the default value i
  • getNumber
    Looks up the given key in the given map, converting the result into a number, using the default valu
  • getObject
    Looks up the given key in the given map, converting null into the given default value.
  • getShort
    Looks up the given key in the given map, converting the result into a short, using the default value
  • getObject,
  • getShort,
  • getString,
  • iterableMap,
  • populateMap,
  • printIndent,
  • verbosePrintInternal

Popular in Java

  • Start an intent from android
  • setScale (BigDecimal)
  • findViewById (Activity)
  • getExternalFilesDir (Context)
  • Thread (java.lang)
    A thread is a thread of execution in a program. The Java Virtual Machine allows an application to ha
  • DateFormat (java.text)
    Formats or parses dates and times.This class provides factories for obtaining instances configured f
  • Date (java.util)
    A specific moment in time, with millisecond precision. Values typically come from System#currentTime
  • BlockingQueue (java.util.concurrent)
    A java.util.Queue that additionally supports operations that wait for the queue to become non-empty
  • Modifier (javassist)
    The Modifier class provides static methods and constants to decode class and member access modifiers
  • LoggerFactory (org.slf4j)
    The LoggerFactory is a utility class producing Loggers for various logging APIs, most notably for lo
  • Best IntelliJ plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now