@Test public void testSetFor () { Platform pf = new StubPlatform(); TypedStorage ts = new TypedStorage(pf.log(), pf.storage()); Function<String,String> id = Functions.identity(); RSet<String> strings = ts.setFor("strings", id, id); assertTrue(strings.isEmpty()); strings.add("one"); assertTrue(ts.setFor("strings", id, id).contains("one")); strings.remove("one"); assertTrue(ts.setFor("strings", id, id).isEmpty()); strings.add(""); assertTrue(ts.setFor("strings", id, id).contains("")); strings.add("two"); assertTrue(ts.setFor("strings", id, id).contains("")); strings.remove("two"); assertTrue(ts.setFor("strings", id, id).contains("")); strings.remove(""); assertFalse(ts.setFor("strings", id, id).contains("")); }
public <E> RSet<E> setFor (String key, Function<String,E> toFunc, Function<E,String> fromFunc) { return setFor(key, toFunc, fromFunc, new HashSet<E>()); }
TypedStorage { public <E> RSet<E> setFor (String key, Function<String,E> toFunc, Function<E,String> fromFunc) { return setFor(key, toFunc, fromFunc, new HashSet<E>()); } }
TypedStorage { public <E> RSet<E> setFor (String key, Function<String,E> toFunc, Function<E,String> fromFunc) { return setFor(key, toFunc, fromFunc, new HashSet<E>()); } TypedStorage(Log log, Storage storage); }
TypedStorage { public <E> RSet<E> setFor (String key, Function<String,E> toFunc, Function<E,String> fromFunc) { return setFor(key, toFunc, fromFunc, new HashSet<E>()); } TypedStorage(Log log, Storage storage); boolean contains(String key); String get(String key); String get(String key, String defval); void set(String key, String value); int get(String key, int defval); void set(String key, int value); long get(String key, long defval); void set(String key, long value); double get(String key, double defval); void set(String key, double value); boolean get(String key, boolean defval); void set(String key, boolean value); E get(String key, E defval); void set(String key, Enum<?> value); void remove(String key); Value<String> valueFor(final String key, String defval); IntValue valueFor(final String key, int defval); Value<Long> valueFor(final String key, long defval); Value<Double> valueFor(final String key, double defval); Value<Boolean> valueFor(final String key, boolean defval); Value<E> valueFor(final String key, E defval); RSet<E> setFor(String key, Function<String,E> toFunc, Function<E,String> fromFunc); RSet<E> setFor(final String key, Function<String,E> toFunc,
                               final Function<E,String> fromFunc, Set<E> impl); }
TypedStorage { public <E> RSet<E> setFor (String key, Function<String,E> toFunc, Function<E,String> fromFunc) { return setFor(key, toFunc, fromFunc, new HashSet<E>()); } TypedStorage(Log log, Storage storage); boolean contains(String key); String get(String key); String get(String key, String defval); void set(String key, String value); int get(String key, int defval); void set(String key, int value); long get(String key, long defval); void set(String key, long value); double get(String key, double defval); void set(String key, double value); boolean get(String key, boolean defval); void set(String key, boolean value); E get(String key, E defval); void set(String key, Enum<?> value); void remove(String key); Value<String> valueFor(final String key, String defval); IntValue valueFor(final String key, int defval); Value<Long> valueFor(final String key, long defval); Value<Double> valueFor(final String key, double defval); Value<Boolean> valueFor(final String key, boolean defval); Value<E> valueFor(final String key, E defval); RSet<E> setFor(String key, Function<String,E> toFunc, Function<E,String> fromFunc); RSet<E> setFor(final String key, Function<String,E> toFunc,
                               final Function<E,String> fromFunc, Set<E> impl);  }