Tabnine Logo
Map.isEmpty
Code IndexAdd Tabnine to your IDE (free)

How to use
isEmpty
method
in
java.util.Map

Best Java code snippets using java.util.Map.isEmpty (Showing top 20 results out of 104,058)

Refine searchRefine arrow

  • Map.entrySet
  • Map.Entry.getValue
  • Map.Entry.getKey
  • Map.get
  • Map.put
origin: google/guava

Itr() {
 keyIterator = map.entrySet().iterator();
 key = null;
 collection = null;
 valueIterator = Iterators.emptyModifiableIterator();
}
origin: skylot/jadx

private void attachSourceLine(int decompiledLine, int sourceLine) {
  if (lineMap.isEmpty()) {
    lineMap = new TreeMap<>();
  }
  lineMap.put(decompiledLine, sourceLine);
}
origin: google/guava

@VisibleForTesting
static char[][] createReplacementArray(Map<Character, String> map) {
 checkNotNull(map); // GWT specific check (do not optimize)
 if (map.isEmpty()) {
  return EMPTY_REPLACEMENT_ARRAY;
 }
 char max = Collections.max(map.keySet());
 char[][] replacements = new char[max + 1][];
 for (char c : map.keySet()) {
  replacements[c] = map.get(c).toCharArray();
 }
 return replacements;
}
origin: stanfordnlp/CoreNLP

public Map<String, String> classORRestrictionsAsString(){
 if(classORrestrictions== null || classORrestrictions.isEmpty())
  return null;
 Map<String, String> str = new HashMap<>();
 for(Map.Entry<Class, String> en: classORrestrictions.entrySet()){
   str.put(class2KeyMapping.get(en.getKey()), en.getValue());
 }
 return str;
}
origin: org.assertj/assertj-core

private static boolean noNonMatchingModifier(Set<String> expectedMethodNames, Map<String, Integer> methodsModifier,
                       Map<String, String> nonMatchingModifiers, int modifier) {
 for (String method : methodsModifier.keySet()) {
  if (expectedMethodNames.contains(method) && (methodsModifier.get(method) & modifier) == 0) {
   nonMatchingModifiers.put(method, Modifier.toString(methodsModifier.get(method)));
  }
 }
 return nonMatchingModifiers.isEmpty();
}
origin: google/guava

@CanIgnoreReturnValue
private Map<R, V> removeColumn(Object column) {
 Map<R, V> output = new LinkedHashMap<>();
 Iterator<Entry<R, Map<C, V>>> iterator = backingMap.entrySet().iterator();
 while (iterator.hasNext()) {
  Entry<R, Map<C, V>> entry = iterator.next();
  V value = entry.getValue().remove(column);
  if (value != null) {
   output.put(entry.getKey(), value);
   if (entry.getValue().isEmpty()) {
    iterator.remove();
   }
  }
 }
 return output;
}
origin: spring-projects/spring-framework

/**
 * Merge a single hint into a map of hints, possibly creating and copying
 * all hints into a new map, or otherwise if the map of hints is empty,
 * creating a new single entry map.
 * @param hints a map of hints to be merge
 * @param hintName the hint name to merge
 * @param hintValue the hint value to merge
 * @return a single map with all hints
 */
public static Map<String, Object> merge(Map<String, Object> hints, String hintName, Object hintValue) {
  if (hints.isEmpty()) {
    return Collections.singletonMap(hintName, hintValue);
  }
  else {
    Map<String, Object> result = new HashMap<>(hints.size() + 1);
    result.putAll(hints);
    result.put(hintName, hintValue);
    return result;
  }
}
origin: google/guava

public void testAsMapEmpty() {
 Set<String> strings = ImmutableSet.of();
 Map<String, Integer> map = Maps.asMap(strings, LENGTH_FUNCTION);
 assertThat(map.entrySet()).isEmpty();
 assertTrue(map.isEmpty());
 assertNull(map.get("five"));
}
origin: mpusher/mpush

@Override
public <T> Map<String, T> hgetAll(String key, Class<T> clazz) {
  Map<String, Object> m = (Map) cache.get(key);
  if (m == null || m.isEmpty()) return Collections.emptyMap();
  Map<String, T> result = new HashMap<>();
  for (Map.Entry<String, Object> o : m.entrySet()) {
    result.put(o.getKey(), Jsons.fromJson(String.valueOf(o.getValue()), clazz));
  }
  return result;
}
origin: spring-projects/spring-framework

protected void detectResourceHandlers(ApplicationContext appContext) {
  Map<String, SimpleUrlHandlerMapping> beans = appContext.getBeansOfType(SimpleUrlHandlerMapping.class);
  List<SimpleUrlHandlerMapping> mappings = new ArrayList<>(beans.values());
  AnnotationAwareOrderComparator.sort(mappings);
  for (SimpleUrlHandlerMapping mapping : mappings) {
    for (String pattern : mapping.getHandlerMap().keySet()) {
      Object handler = mapping.getHandlerMap().get(pattern);
      if (handler instanceof ResourceHttpRequestHandler) {
        ResourceHttpRequestHandler resourceHandler = (ResourceHttpRequestHandler) handler;
        this.handlerMap.put(pattern, resourceHandler);
      }
    }
  }
  if (this.handlerMap.isEmpty()) {
    logger.trace("No resource handling mappings found");
  }
}
origin: prestodb/presto

public void setLocalDefinitions(Map<Class<?>, Class<?>> sourceMixins) {
  if (sourceMixins == null || sourceMixins.isEmpty()) {
    _localMixIns = null;
  } else {
    Map<ClassKey,Class<?>> mixIns = new HashMap<ClassKey,Class<?>>(sourceMixins.size());
    for (Map.Entry<Class<?>,Class<?>> en : sourceMixins.entrySet()) {
      mixIns.put(new ClassKey(en.getKey()), en.getValue());
    }
    _localMixIns = mixIns;
  }
}
origin: spring-projects/spring-framework

@Override
@Nullable
public Class<?> predictBeanType(Class<?> beanClass, String beanName) {
  if (this.proxyTypes.isEmpty()) {
    return null;
  }
  Object cacheKey = getCacheKey(beanClass, beanName);
  return this.proxyTypes.get(cacheKey);
}
origin: jenkinsci/jenkins

  private boolean hasMatchingEnvVars2(Map<String,String> modelEnvVar) throws WindowsOSProcessException {
    if(modelEnvVar.isEmpty())
      // sanity check so that we don't start rampage.
      return false;
    SortedMap<String,String> envs = getEnvironmentVariables2();
    for (Entry<String,String> e : modelEnvVar.entrySet()) {
      String v = envs.get(e.getKey());
      if(v==null || !v.equals(e.getValue()))
        return false;   // no match
    }
    return true;
  }
}
origin: skylot/jadx

private Object attachAnnotation(Object obj, CodePosition pos) {
  if (annotations.isEmpty()) {
    annotations = new HashMap<>();
  }
  return annotations.put(pos, obj);
}
origin: apache/hbase

private void mergeAssignmentMaps(Map<ServerName, List<RegionInfo>> assignmentMap,
  Map<ServerName, List<RegionInfo>> otherAssignments) {
 if (otherAssignments == null || otherAssignments.isEmpty()) {
  return;
 }
 for (Entry<ServerName, List<RegionInfo>> entry : otherAssignments.entrySet()) {
  ServerName sn = entry.getKey();
  List<RegionInfo> regionsList = entry.getValue();
  if (assignmentMap.get(sn) == null) {
   assignmentMap.put(sn, Lists.newArrayList(regionsList));
  } else {
   assignmentMap.get(sn).addAll(regionsList);
  }
 }
}
origin: apache/geode

protected void initializeFieldAnalyzers(Map<String, Analyzer> fieldAnalyzers) {
 this.fieldAnalyzers = new HashMap<>();
 for (String field : fieldNames) {
  if (fieldAnalyzers != null && !fieldAnalyzers.isEmpty()) {
   this.fieldAnalyzers.put(field,
     fieldAnalyzers.get(field) == null ? StandardAnalyzer.class.getSimpleName()
       : fieldAnalyzers.get(field).getClass().getSimpleName());
  } else {
   this.fieldAnalyzers.put(field, StandardAnalyzer.class.getSimpleName());
  }
 }
}
origin: Graylog2/graylog2-server

  private Map<String, String> prefixElements(final String prefix, final Map<String, String> elements) {
    if (elements == null || elements.isEmpty()) {
      return Collections.emptyMap();
    }

    final Map<String, String> prefixedMap = new HashMap<>(elements.size());
    for (Map.Entry<String, String> entry : elements.entrySet()) {
      prefixedMap.put(prefix.trim() + "_" + entry.getKey(), entry.getValue());
    }

    return prefixedMap;
  }
}
origin: eclipse-vertx/vert.x

public X509KeyManager getKeyMgr(String serverName) {
 X509KeyManager mgr = mgrMap.get(serverName);
 if (mgr == null && !wildcardMgrMap.isEmpty()) {
  int index = serverName.indexOf('.') + 1;
  if (index > 0) {
   String s = serverName.substring(index);
   mgr = wildcardMgrMap.get(s);
  }
 }
 return mgr;
}
origin: bumptech/glide

@Override
public String toString() {
 StringBuilder sb =
   new StringBuilder()
     .append("SizeConfigStrategy{groupedMap=")
     .append(groupedMap)
     .append(", sortedSizes=(");
 for (Map.Entry<Bitmap.Config, NavigableMap<Integer, Integer>> entry : sortedSizes.entrySet()) {
  sb.append(entry.getKey()).append('[').append(entry.getValue()).append("], ");
 }
 if (!sortedSizes.isEmpty()) {
  sb.replace(sb.length() - 2, sb.length(), "");
 }
 return sb.append(")}").toString();
}
origin: square/okhttp

/**
 * Attaches {@code tag} to the request using {@code type} as a key. Tags can be read from a
 * request using {@link Request#tag}. Use null to remove any existing tag assigned for {@code
 * type}.
 *
 * <p>Use this API to attach timing, debugging, or other application data to a request so that
 * you may read it in interceptors, event listeners, or callbacks.
 */
public <T> Builder tag(Class<? super T> type, @Nullable T tag) {
 if (type == null) throw new NullPointerException("type == null");
 if (tag == null) {
  tags.remove(type);
 } else {
  if (tags.isEmpty()) tags = new LinkedHashMap<>();
  tags.put(type, type.cast(tag));
 }
 return this;
}
java.utilMapisEmpty

Javadoc

Returns whether this map is empty.

Popular methods of Map

  • put
    Maps the specified key to the specified value.
  • get
  • entrySet
    Returns a Set view of the mappings contained in this map. The set is backed by the map, so changes t
  • containsKey
    Returns whether this Map contains the specified key.
  • keySet
    Returns a set of the keys contained in this Map. The Set is backed by this Map so changes to one are
  • values
    Returns a Collection view of the values contained in this map. The collection is backed by the map,
  • remove
  • size
    Returns the number of mappings in this Map.
  • clear
    Removes all elements from this Map, leaving it empty.
  • putAll
    Copies all of the mappings from the specified map to this map (optional operation). The effect of th
  • forEach
  • equals
    Compares the argument to the receiver, and returns true if the specified object is a Map and both Ma
  • forEach,
  • equals,
  • computeIfAbsent,
  • hashCode,
  • getOrDefault,
  • containsValue,
  • putIfAbsent,
  • compute,
  • merge

Popular in Java

  • Making http post requests using okhttp
  • getContentResolver (Context)
  • getResourceAsStream (ClassLoader)
  • findViewById (Activity)
  • Thread (java.lang)
    A thread is a thread of execution in a program. The Java Virtual Machine allows an application to ha
  • ServerSocket (java.net)
    This class represents a server-side socket that waits for incoming client connections. A ServerSocke
  • Locale (java.util)
    Locale represents a language/country/variant combination. Locales are used to alter the presentatio
  • Set (java.util)
    A Set is a data structure which does not allow duplicate elements.
  • Stack (java.util)
    Stack is a Last-In/First-Out(LIFO) data structure which represents a stack of objects. It enables u
  • LogFactory (org.apache.commons.logging)
    Factory for creating Log instances, with discovery and configuration features similar to that employ
  • Top Sublime Text 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