/** * Removes all entries from this map */ public void clear() { getUnderlyingMap().clear(); }
/** * Boilerplate method to access all entries of this map as {@link Stream}. * <p> * <b>Note</b>: Calling {@link sirius.kernel.commons.Tuple#flatten(java.util.Map.Entry)} via * {@link Stream#flatMap(java.util.function.Function)} will transform the resulting stream into a stream of * all pairs represented by this map. * * @return a <tt>Stream</tt> containing all entries of this map */ public Stream<Map.Entry<K, Collection<V>>> stream() { return getUnderlyingMap().entrySet().stream(); } }
/** * Returns a list of all values for all keys. * <p> * Note that this list has no <tt>Set</tt> like behaviour. Therefore the same value might occur several times * if it was added more than once for the same or for different keys. * * @return a list of all values stored for all keys */ @Nonnull public List<V> values() { List<V> result = new ArrayList<>(); for (Collection<V> val : getUnderlyingMap().values()) { result.addAll(val); } return result; }
@Override public synchronized void registerDynamicPart(String uniqueName, Object part, Class<?> lookupClass) { Map<String, Object> partsOfClass = namedParts.get(lookupClass); if (partsOfClass != null) { Object originalPart = partsOfClass.get(uniqueName); if (originalPart != null) { partsOfClass.remove(uniqueName); Collection<Object> specificParts = parts.getUnderlyingMap().get(lookupClass); if (specificParts != null) { specificParts.remove(originalPart); } } } registerPart(uniqueName, part, lookupClass); }
private void registerPart(Object part, Class<?>[] implementedInterfaces, Class<?> predecessor, Object successor) { for (Class<?> iFace : implementedInterfaces) { if (successor == null) { parts.put(iFace, part); if (predecessor != null) { synchronized (parts) { parts.getUnderlyingMap().get(iFace).removeIf(p -> p.getClass().equals(predecessor)); } } } else { synchronized (parts) { Collection<Object> partList = parts.getUnderlyingMap().get(iFace); if (partList == null || !partList.contains(successor)) { parts.put(iFace, part); } } } } }
@SuppressWarnings({"squid:S1854", "squid:S1481"}) @Explain("False positive - the set is used.") void processAnnotations() { Set<Object> initializedObjects = new HashSet<>(); parts.getUnderlyingMap().values().stream().flatMap(Collection::stream).forEach(part -> { wire(part); if (part instanceof Initializable) { if (!initializedObjects.contains(part)) { initializedObjects.add(part); initialize(part); } } }); }
for (Map.Entry<String, Collection<Table>> target : targetByRealm.getUnderlyingMap().entrySet()) { try { Extension ext = Sirius.getSettings().getExtension(EXTENSION_MIXING_JDBC, target.getKey());