/** Returns the message loader for this language. * @since 5.0.11 */ public Collection<MessageLoader> getMessageLoaders() { return new CollectionsX.ArrayCollection<MessageLoader>(_msgloads.toArray()); }
@SuppressWarnings("unchecked") public Set<Map.Entry<K,V>> entrySet() { tryExpunge(); return new EntrySet(); }
/** Returns the default locale, either {@link #getLocale} or * {@link Locales#getCurrent} (never null). * It is useful when you wan to get a locale for this input. * @since 5.0.10 */ protected Locale getDefaultLocale() { return _locale != null ? _locale : Locales.getCurrent(); }
/** Constructs a cache map with the specified max size and lifetime. * @param accessOrder whether to use the access order. * Specify false for the insertion order. * @since 6.0.0 */ public CacheMap(int maxSize, int lifetime, boolean accessOrder) { this(accessOrder); setMaxSize(maxSize); setLifetime(lifetime); } /** Constructs a cache map.
public void clear() { synchronized (this) { setReadAndClearWrite(new InnerCache(getMaxSize(), getLifetime())); } }
/** Synchronizes _writeCache to _cache. ** <p>synchronized(this) before calling this */ private void syncToReadCache() { //don't check _moreInWriteCache here because it might be called //in remove() (when _writeCache is less but still need to sync) _missCnt = 0; _moreInWriteCache = false; final InnerCache cache = new InnerCache(getMaxSize(), getLifetime()); cache.putAll(_writeCache); _cache = cache; //no need free to free _writeCache, since write faster (GC will clear it in expunge) } /** Synchronized from _cache to _writeCache.
public boolean containsKey(Object key) { final CacheMap<K, V> cache = getCache(key); synchronized (cache) { return cache.containsKey(key); } } public V get(Object key) {
@SuppressWarnings("unchecked") public Collection<V> values() { tryExpunge(); return new Values(); }
public Object clone() { MultiCache clone = new MultiCache(_caches.length, _maxsize, _lifetime); for (int j = 0; j < _caches.length; ++j) if (_caches[j] != null) synchronized (_caches[j]) { clone._caches[j] = (CacheMap)_caches[j].clone(); } return clone; } }
@SuppressWarnings("unchecked") public Set<K> keySet() { tryExpunge(); return new KeySet(); }
/** Creates a branch (non-leaf) node. * @param children a collection of children (they must be {@link DefaultTreeNode} too). * If null or empty, it means * no children at all. However, it still allows to add children. * If it is not allowed, please use {@link #DefaultTreeNode(Object)} instead. */ public DefaultTreeNode(E data, TreeNode<E>[] children) { this(data, new ArrayCollection<TreeNode<E>>(children)); }
private static Component[] merge(Component[] cs, Component c) { if (c != null) { cs = ArraysX.resize(cs, cs.length + 1); cs[cs.length - 1] = c; } return cs; }
/** Returns an iterator that allows the caller to modify the collection * directly (in addition to Iterator.remove()). * @param converter the filter used to convert the value of each element * found in the given collection to the return iterator. * Ignored if null (and then F must be the same as T or extends from T). * @since 6.0.0 */ public static <F, T> Iterator<T> comodifiableIterator(Collection<F> col, Converter<F, T> converter) { return new ComodifiableIterator<F, T>(col, converter); } }
/** Constructor. */ public FastReadCache(int maxSize, int lifetime) { _cache = new InnerCache(maxSize, lifetime); }
/** Returns a readonly list of all {@link JavaScript} required * by this language. */ public Collection<JavaScript> getJavaScripts() { return new CollectionsX.ArrayCollection<JavaScript>(_js.toArray()); }
/** Returns a readonly list of all {@link StyleSheet} required * by this language. */ public Collection<StyleSheet> getStyleSheets() { return new CollectionsX.ArrayCollection<StyleSheet>(_ss.toArray()); }