@Test public void testListingIsSorted() { final String topic1 = "TopicA"; final String topic2 = "AnotherTopic"; final String topic3 = "123Topic"; final List<TopicListing> topicListingList = new ArrayList<>(); topicListingList.add(new TopicListing(topic1, false)); topicListingList.add(new TopicListing(topic2, false)); topicListingList.add(new TopicListing(topic3, false)); final TopicList topicList = new TopicList(topicListingList); final List<String> results = topicList.getTopicNames(); assertEquals(topic3, results.get(0)); assertEquals(topic2, results.get(1)); assertEquals(topic1, results.get(2)); }
public List<String> getTopicNames() { final List<String> topicNames = new ArrayList<>(); for (final TopicListing topicListing: getTopics()) { topicNames.add(topicListing.getName()); } return Collections.unmodifiableList(topicNames); }
TopicList { public List<String> getTopicNames() { final List<String> topicNames = new ArrayList<>(); for (final TopicListing topicListing: getTopics()) { topicNames.add(topicListing.getName()); } return Collections.unmodifiableList(topicNames); } }
TopicList { public List<String> getTopicNames() { final List<String> topicNames = new ArrayList<>(); for (final TopicListing topicListing: getTopics()) { topicNames.add(topicListing.getName()); } return Collections.unmodifiableList(topicNames); } TopicList(final List<TopicListing> topics); }
TopicList { public List<String> getTopicNames() { final List<String> topicNames = new ArrayList<>(); for (final TopicListing topicListing: getTopics()) { topicNames.add(topicListing.getName()); } return Collections.unmodifiableList(topicNames); } TopicList(final List<TopicListing> topics); List<TopicListing> getTopics(); List<String> getTopicNames(); TopicList filterByTopicName(final String search); @Override String toString(); }
TopicList { public List<String> getTopicNames() { final List<String> topicNames = new ArrayList<>(); for (final TopicListing topicListing: getTopics()) { topicNames.add(topicListing.getName()); } return Collections.unmodifiableList(topicNames); } TopicList(final List<TopicListing> topics); List<TopicListing> getTopics(); List<String> getTopicNames(); TopicList filterByTopicName(final String search); @Override String toString();  }