!7 sclass LinkedToken { S t; LinkedToken prev, next; LinkedToken prevIdentical, nextIdentical; *() {} *(S *t) {} } sclass Tokenization { LinkedToken first, last; new Map firstByContent; new Map lastByContent; } p-experiment { S text = "hello hello"; L tokens = javaTok(text); new Tokenization tok; for (S t : tokens) { LinkedToken lt = new(t); lt.t = t; if (tok.first == null) tok.first = lt; else { lt.prev = tok.last; tok.last.next = lt; } tok.last = lt; lt.prevIdentical = tok.lastByContent.get(t); if (lt.prevIdentical == null) tok.firstByContent.put(t, lt); else { lt.prevIdentical.nextIdentical = lt; } tok.lastByContent.put(t, lt); } printStruct(tok); }