/** * Transforms a map. * <p> * The transformer itself may throw an exception if necessary. * * @param map the map to transform * @return the transformed object */ @SuppressWarnings("unchecked") protected Map<K, V> transformMap(final Map<? extends J, ? extends U> map) { if (map.isEmpty()) { return (Map<K, V>) map; } final Map<K, V> result = new LinkedMap<>(map.size()); for (final Map.Entry<? extends J, ? extends U> entry : map.entrySet()) { result.put(transformKey(entry.getKey()), transformValue(entry.getValue())); } return result; }
/** * Transforms a map. * <p> * The transformer itself may throw an exception if necessary. * * @param map the map to transform * @return the transformed object */ @SuppressWarnings("unchecked") protected Map<K, V> transformMap(final Map<? extends K, ? extends V> map) { if (map.isEmpty()) { return (Map<K, V>) map; } final Map<K, V> result = new LinkedMap<>(map.size()); for (final Map.Entry<? extends K, ? extends V> entry : map.entrySet()) { result.put(transformKey(entry.getKey()), transformValue(entry.getValue())); } return result; }
/** * Empty lineage for objects rooted in the URL. */ public ResourceLineage() { resourceMap = new LinkedMap<>(); }
/** * Empty lineage for objects rooted in the URL. */ public ResourceLineage() { resourceMap = new LinkedMap<>(); }
/** * Extends a lineage with a new resource. * @param sharedLineage the shared lineage * @param next the next */ public ResourceLineage(ResourceLineage sharedLineage, PersistentResource next) { resourceMap = new LinkedMap<>(sharedLineage.resourceMap); addRecord(next); }
/** * Extends a lineage with a new resource. * @param sharedLineage the shared lineage * @param next the next */ public ResourceLineage(ResourceLineage sharedLineage, PersistentResource next) { resourceMap = new LinkedMap<>(sharedLineage.resourceMap); addRecord(next); }
/** * Extends a lineage with a new resource that has an alias. An alias is useful if * there are two objects in the lineage with the same type or class. The resource * lineage does not allow two resources to have the same name. As long as one of the two * resources can be given an alias (by annotation), then two objects with the same type/class * can exist in the lineage. This case is likely to be uncommon. * @param sharedLineage the shared lineage * @param next the next * @param nextAlias the next alias */ public ResourceLineage(ResourceLineage sharedLineage, PersistentResource next, String nextAlias) { resourceMap = new LinkedMap<>(sharedLineage.resourceMap); addRecord(next, nextAlias); }
/** * Extends a lineage with a new resource that has an alias. An alias is useful if * there are two objects in the lineage with the same type or class. The resource * lineage does not allow two resources to have the same name. As long as one of the two * resources can be given an alias (by annotation), then two objects with the same type/class * can exist in the lineage. This case is likely to be uncommon. * @param sharedLineage the shared lineage * @param next the next * @param nextAlias the next alias */ public ResourceLineage(ResourceLineage sharedLineage, PersistentResource next, String nextAlias) { resourceMap = new LinkedMap<>(sharedLineage.resourceMap); addRecord(next, nextAlias); }
protected void doGroup() { roots = new LinkedList<>(); parents = new LinkedHashMap<>(); children = new HashMap<>(); groupItems = new HashMap<>(); itemGroups = new HashMap<>(); for (E item : container.getItems()) { GroupInfo<MetaPropertyPath> groupInfo = groupItems(0, null, roots, item, new LinkedMap<>()); if (groupInfo == null) { throw new IllegalStateException("Item group cannot be NULL"); } List<K> itemsIds = groupItems.computeIfAbsent(groupInfo, k -> new ArrayList<>()); itemsIds.add(item.getId()); } }
protected void doGroup() { roots = new LinkedList<>(); parents = new LinkedHashMap<>(); children = new HashMap<>(); groupItems = new HashMap<>(); itemGroups = new HashMap<>(); Collection<K> itemIds = datasource.getItemIds(); for (K id : itemIds) { T item = datasource.getItem(id); GroupInfo<MetaPropertyPath> groupInfo = groupItems(0, null, roots, item, new LinkedMap<>()); if (groupInfo == null) { throw new IllegalStateException("Item group cannot be NULL"); } List<K> itemsIds = groupItems.computeIfAbsent(groupInfo, k -> new ArrayList<>()); itemsIds.add(id); } }
private Object readObject(JsonReader in) throws IOException { final Map<String, Object> map = new LinkedMap<>(); in.beginObject(); if (collectionTypeAdapter == null) { while (in.hasNext()) { map.put(in.nextName(), read(in)); } } else { while (in.hasNext()) { map.put(in.nextName(), collectionTypeAdapter.read(in)); } } in.endObject(); return map; }
@SuppressWarnings("unchecked") public GroupInfo(LinkedMap groupingValues) { this.groupingValues = new LinkedMap(groupingValues); this.groupProperty = (P) groupingValues.get(groupingValues.size() - 1); }
Map<String, Component> newChildren = new LinkedMap<>(MAPIFY_THRESHOLD * 2); for (Component curChild : childrenList)
Map<String, Component> newChildren = new LinkedMap<>(MAPIFY_THRESHOLD * 2); for (Component curChild : childrenList)