/** creates a {@link Navigator} backed by a newly created map; * the map can be accessed by {@link Navigator#getMap()} */ public static Navigator<MutableMap<Object,Object>> newInstance() { return new Navigator<MutableMap<Object,Object>>(new MutableMap<Object,Object>(), MutableMap.class); } /** convenience for {@link Navigator#at(Object, Object...)} on a {@link #newInstance()} */
public SizeHistory(long windowSize) { recentDesiredResizes = new TimeWindowedList<Number>(MutableMap.of("timePeriod", windowSize, "minExpiredVals", 1)); }
public AbstractNonProvisionedControllerImpl(Map properties, Entity parent, Cluster cluster) { serverPoolMemberTrackerPolicy = new AbstractMembershipTrackingPolicy(MutableMap.of("name", "Controller targets tracker")) { protected void onEntityChange(Entity member) { onServerPoolMemberChanged(member); } protected void onEntityAdded(Entity member) { onServerPoolMemberChanged(member); } protected void onEntityRemoved(Entity member) { onServerPoolMemberChanged(member); } }; }
public static <K,V> MutableMap<K,V> of(K k1, V v1, K k2, V v2, K k3, V v3) { MutableMap<K,V> result = new MutableMap<K,V>(); result.put(k1, v1); result.put(k2, v2); result.put(k3, v3); return result; }
public static <V> MutableSet<V> of(V v1) { MutableSet<V> result = new MutableSet<V>(); result.add(v1); return result; }
/** as {@link #put(Object, Object)} but fluent style */ public MutableMap<K,V> add(K key, V value) { put(key, value); return this; }
/** as {@link #put(Object, Object)} but excluding null values, and fluent style */ public MutableMap<K,V> addIfNotNull(K key, V value) { if (value!=null) add(key, value); return this; }
@Override protected Object createCollection(Class type) { return new MutableSet<Object>(); } }
public Builder<K, V> removeAll(K... keys) { for (K key : keys) { result.remove(key); } return this; }
public Navigator<T> atArray(Object[] furtherPathSegments) { for (Object p: furtherPathSegments) down(p); return this; }
/** @deprecated since 0.6.0 ambiguous with {@link #removeAll(Iterable)}; * use <code>removeAll(Arrays.asList(Object, Object, Object...))</code> */ public Builder<V> removeAll(V... values) { for (V v : values) { result.remove(v); } return this; }
public static <K,V> MutableMap<K,V> of(K k1, V v1, K k2, V v2, K k3, V v3,K k4, V v4) { MutableMap<K,V> result = new MutableMap<K,V>(); result.put(k1, v1); result.put(k2, v2); result.put(k3, v3); result.put(k4, v4); return result; }
public static <V> MutableSet<V> of(V v1, V v2) { MutableSet<V> result = new MutableSet<V>(); result.add(v1); result.add(v2); return result; }
/** as {@link List#add(Object)} but excluding nulls, and fluent style */ public MutableList<V> appendIfNotNull(V item) { if (item!=null) add(item); return this; }
/** as {@link List#addAll(Collection)} but fluent style */ public MutableList<V> appendAll(Iterable<? extends V> items) { for (V item: items) add(item); return this; }