 |
Crossfire JXClient, Trunk
|
Go to the documentation of this file.
23 package com.realtime.crossfire.jxclient.skin.skin;
25 import java.util.ArrayList;
26 import java.util.Collection;
27 import java.util.Collections;
28 import java.util.Iterator;
29 import java.util.LinkedHashMap;
30 import java.util.List;
32 import org.jetbrains.annotations.NotNull;
33 import org.jetbrains.annotations.Nullable;
53 private final Map<String, T>
cache =
new LinkedHashMap<>();
78 if (
cache.containsKey(name)) {
93 final T t =
cache.get(name);
107 final List<String> result =
new ArrayList<>(
cache.keySet());
108 result.sort(String::compareTo);
119 return cache.get(name);
129 return Collections.unmodifiableCollection(
cache.values()).iterator();
JXCSkinCache(@NotNull final String ident)
Creates a new instance.
final Map< String, T > cache
The cached elements.
T lookup(@NotNull final String name)
Looks up an element by name.
Iterator< T > iterator()
Returns all stored values.
void clear()
Forgets all cached elements.
Implements a cache for elements identified by name.
Collection< String > getNames()
Returns all defined names.
Exception thrown if a skin related problem occurs.
void insert(@NotNull final String name, @NotNull final T t)
Adds a new element to the cache.
T lookupOptional(@NotNull final String name)
Looks up an element by name.
final String ident
The description of this cache used for creating error messages.