@Test public void testGetSubtopic() { Topic joe = Topics.getTopic("Joe"); Topic joebob1 = Topics.getTopic("Joe", "Bob"); Topic joebob2 = Topics.getSubtopic(joe, "Bob"); assertTrue(joe.isSubtopic(joebob2)); assertTrue(joebob1.equals(joebob2)); assertEquals(0, joebob1.compareTo(joebob2)); assertEquals(0, joebob2.compareTo(joebob1)); assertEquals(joebob1.hashCode(), joebob2.hashCode()); }
public static Topic getSubtopic(Topic topic, String field) { String[] baseFields = topic.getFields(); String[] fields = new String[baseFields.length + 1]; System.arraycopy(baseFields, 0, fields, 0, baseFields.length); fields[baseFields.length] = field; return new TopicImpl(fields); }
Topics { public static Topic getSubtopic(Topic topic, String field) { String[] baseFields = topic.getFields(); String[] fields = new String[baseFields.length + 1]; System.arraycopy(baseFields, 0, fields, 0, baseFields.length); fields[baseFields.length] = field; return new TopicImpl(fields); } }
Topics { public static Topic getSubtopic(Topic topic, String field) { String[] baseFields = topic.getFields(); String[] fields = new String[baseFields.length + 1]; System.arraycopy(baseFields, 0, fields, 0, baseFields.length); fields[baseFields.length] = field; return new TopicImpl(fields); }  }
Topics { public static Topic getSubtopic(Topic topic, String field) { String[] baseFields = topic.getFields(); String[] fields = new String[baseFields.length + 1]; System.arraycopy(baseFields, 0, fields, 0, baseFields.length); fields[baseFields.length] = field; return new TopicImpl(fields); }  static Topic getSubtopic(Topic topic, String field); static Topic getTopic(String name); static Topic getTopic(String... fields); static Topic parse(String s); static String toString(Topic topic); }
Topics { public static Topic getSubtopic(Topic topic, String field) { String[] baseFields = topic.getFields(); String[] fields = new String[baseFields.length + 1]; System.arraycopy(baseFields, 0, fields, 0, baseFields.length); fields[baseFields.length] = field; return new TopicImpl(fields); }  static Topic getSubtopic(Topic topic, String field); static Topic getTopic(String name); static Topic getTopic(String... fields); static Topic parse(String s); static String toString(Topic topic);  }