/** * Null-safe check if the specified <code>MultiValuedMap</code> is empty. * <p> * If the provided map is null, returns true. * * @param map the map to check, may be null * @return true if the map is empty or null */ public static boolean isEmpty(final MultiValuedMap<?, ?> map) { return map == null || map.isEmpty(); }
@Override public boolean isEmpty() { return decorated().isEmpty(); }
/** * Factory method to create a transforming MultiValuedMap that will * transform existing contents of the specified map. * <p> * If there are any elements already in the map being decorated, they will * be transformed by this method. Contrast this with * {@link #transformingMap(MultiValuedMap, Transformer, Transformer)}. * * @param <K> the key type * @param <V> the value type * @param map the MultiValuedMap to decorate, may not be null * @param keyTransformer the transformer to use for key conversion, null means no conversion * @param valueTransformer the transformer to use for value conversion, null means no conversion * @return a new transformed MultiValuedMap * @throws NullPointerException if map is null */ public static <K, V> TransformedMultiValuedMap<K, V> transformedMap(final MultiValuedMap<K, V> map, final Transformer<? super K, ? extends K> keyTransformer, final Transformer<? super V, ? extends V> valueTransformer) { final TransformedMultiValuedMap<K, V> decorated = new TransformedMultiValuedMap<>(map, keyTransformer, valueTransformer); if (!map.isEmpty()) { final MultiValuedMap<K, V> mapCopy = new ArrayListValuedHashMap<>(map); decorated.clear(); decorated.putAll(mapCopy); } return decorated; }
/** * Checks that {@code value} is not null and not empty. */ // The rest of the Javadoc is inherited @Override @SuppressWarnings("unchecked") protected boolean isFieldEmptyForWrite(Object value) { return super.isFieldEmptyForWrite(value) || ((MultiValuedMap<Object, Object>)value).isEmpty(); } }
@Override public void extendTerm(VocabularyInputTerm term, Vocabulary vocabulary) { MultiValuedMap<String, String> termData = this.data.get(term.getId()); if (termData == null || termData.isEmpty()) { return; } for (Map.Entry<String, Collection<String>> datum : termData.asMap().entrySet()) { if (!datum.getValue().isEmpty()) { term.set(datum.getKey(), datum.getValue()); } } }
@SuppressWarnings("unchecked") final MultiValuedMap<String,T> m = (MultiValuedMap<String,T>) r.getBeanField().getFieldValue(bean); if(m != null && !m.isEmpty()) { for(Map.Entry<String,T> entry : m.entries()) { String key = entry.getKey();
final MultiValuedMap<Integer,T> m = (MultiValuedMap<Integer, T>) r.getBeanField().getFieldValue(bean); boolean oneEntryMatched = false; if(m != null && !m.isEmpty()) { for(Map.Entry<Integer,T> entry : m.entries()) { Integer key = entry.getKey(); if(m == null || m.isEmpty() || !oneEntryMatched) { if(r.getBeanField().isRequired()) { missingRequiredHeaders.add(r.getBeanField().getField());
if (suggestions.isEmpty() || annotations.isEmpty()) { continue;
remainingAttemptDurations.add(attemptDuration); while (!socketIdToRequests.isEmpty() && !remainingAttemptDurations.isEmpty()) {