static List<Msg> process(List<Msg> received) {
Set<Msg> set = new HashSet<>(received); return new ArrayList<>(set);}
class Msg {
public final int sequence; public final String text; public Msg(int sequence, String text) {
this.sequence = sequence; this.text = text; }
@Override public boolean equals(Object o) {
if(o instanceof Msg) {
Msg m = (Msg) o; return this.sequence == m.sequence; }
return false; }
@Override public int hashCode() {
return Objects.hash(this.sequence); }
}
jasmine