Ejemplo n.º 1
0
 public String createTopic(String topic) {
   if (!Topics.containsKey(topic)) {
     ServerChatRoom SCR = new ServerChatRoom(topic);
     SCR.startServer(nextPort++);
     Topics.put(topic, SCR);
   }
   return null;
 }
Ejemplo n.º 2
0
 public Topics getTopics() {
   Topics allTopics = new Topics();
   List<Topic> topicsList = new ArrayList<>();
   topics
       .stream()
       .filter(t -> t.getType().equals("attached"))
       .forEach(t -> topicsList.addAll(t.getTopics()));
   allTopics.setTopics(topicsList);
   return allTopics;
 }
Ejemplo n.º 3
0
 @Override
 public Chatroom joinTopic(String topic) {
   return Topics.get(topic);
 }