@Test public void testToSet() { assertEquals(emptySet, IntegerSetConverter.toSet(emptyString)); assertEquals(null, IntegerSetConverter.toSet(nullString)); assertEquals(oneElementSet, IntegerSetConverter.toSet(oneElementString)); assertEquals(largeSet, IntegerSetConverter.toSet(largeString)); }
@TypeConverter public static Set<Integer> toSet(String string) { if (string == null) return null; if (string.length() == 0) return new HashSet<>(); Set<Integer> set = new HashSet<>(); String[] ints = string.split("#"); for (String s : ints) { set.add(Integer.parseInt(s)); } return set; }
IntegerSetConverter { @TypeConverter public static Set<Integer> toSet(String string) { if (string == null) return null; if (string.length() == 0) return new HashSet<>(); Set<Integer> set = new HashSet<>(); String[] ints = string.split("#"); for (String s : ints) { set.add(Integer.parseInt(s)); } return set; } }
IntegerSetConverter { @TypeConverter public static Set<Integer> toSet(String string) { if (string == null) return null; if (string.length() == 0) return new HashSet<>(); Set<Integer> set = new HashSet<>(); String[] ints = string.split("#"); for (String s : ints) { set.add(Integer.parseInt(s)); } return set; }  }
IntegerSetConverter { @TypeConverter public static Set<Integer> toSet(String string) { if (string == null) return null; if (string.length() == 0) return new HashSet<>(); Set<Integer> set = new HashSet<>(); String[] ints = string.split("#"); for (String s : ints) { set.add(Integer.parseInt(s)); } return set; }  @TypeConverter static Set<Integer> toSet(String string); @TypeConverter static String toString(Set<Integer> set); }
IntegerSetConverter { @TypeConverter public static Set<Integer> toSet(String string) { if (string == null) return null; if (string.length() == 0) return new HashSet<>(); Set<Integer> set = new HashSet<>(); String[] ints = string.split("#"); for (String s : ints) { set.add(Integer.parseInt(s)); } return set; }  @TypeConverter static Set<Integer> toSet(String string); @TypeConverter static String toString(Set<Integer> set);  }