Java subList() gotcha.

Recently I stumbled upon an issue of stuck thread. The thread seemed to be stuck with stack trace something like the one below:- java.util.SubList$1.nextIndex(AbstractList.java:713) java.util.SubList$1.nextIndex(AbstractList.java:713) …Repeated 100s of times… java.util.SubList$1.nextIndex(AbstractList.java:713) java.util.SubList$1.hasNext(AbstractList.java:691) java.util.SubList$1.next(AbstractList.java:695) java.util.SubList$1.next(AbstractList.java:696) …Again repeated 100s of times… java.util.SubList$1.next(AbstractList.java:696) java.util.AbstractList.hashCode(AbstractList.java:526) java.util.Collections$UnmodifiableList.hashCode(Collections.java:1152) org.apache.myfaces.trinidad.util.CollectionUtils$DelegatingCollection.hashCode(CollectionUtils.java:603) … My initial reaction was – huh?! Well googling revealed a blog post […]