@Test public void exceptHeadToken() { assertEquals(Topic.asTopic("token"), Topic.asTopic("/token").exceptHeadToken()); assertEquals(Topic.asTopic("a/b"), Topic.asTopic("/a/b").exceptHeadToken()); }
public Topic exceptHeadToken() { List<Token> tokens = getTokens(); if (tokens.isEmpty()) { return new Topic(Collections.emptyList()); } List<Token> tokensCopy = new ArrayList<>(tokens); tokensCopy.remove(0); return new Topic(tokensCopy); }
Topic implements Serializable { public Topic exceptHeadToken() { List<Token> tokens = getTokens(); if (tokens.isEmpty()) { return new Topic(Collections.emptyList()); } List<Token> tokensCopy = new ArrayList<>(tokens); tokensCopy.remove(0); return new Topic(tokensCopy); } }
Topic implements Serializable { public Topic exceptHeadToken() { List<Token> tokens = getTokens(); if (tokens.isEmpty()) { return new Topic(Collections.emptyList()); } List<Token> tokensCopy = new ArrayList<>(tokens); tokensCopy.remove(0); return new Topic(tokensCopy); } Topic(String topic);   Topic(List<Token> tokens); }
Topic implements Serializable { public Topic exceptHeadToken() { List<Token> tokens = getTokens(); if (tokens.isEmpty()) { return new Topic(Collections.emptyList()); } List<Token> tokensCopy = new ArrayList<>(tokens); tokensCopy.remove(0); return new Topic(tokensCopy); } Topic(String topic);   Topic(List<Token> tokens); static Topic asTopic(String s); List<Token> getTokens(); Token headToken(); boolean isEmpty(); Topic exceptHeadToken(); boolean isValid(); boolean match(Topic subscriptionTopic); @Override String toString(); @Override boolean equals(Object obj); @Override int hashCode(); }
Topic implements Serializable { public Topic exceptHeadToken() { List<Token> tokens = getTokens(); if (tokens.isEmpty()) { return new Topic(Collections.emptyList()); } List<Token> tokensCopy = new ArrayList<>(tokens); tokensCopy.remove(0); return new Topic(tokensCopy); } Topic(String topic);   Topic(List<Token> tokens); static Topic asTopic(String s); List<Token> getTokens(); Token headToken(); boolean isEmpty(); Topic exceptHeadToken(); boolean isValid(); boolean match(Topic subscriptionTopic); @Override String toString(); @Override boolean equals(Object obj); @Override int hashCode();  }