Java: Why subList(0, 5).clear() doesn't work on my objects?
Posted
by serg555
on Stack Overflow
See other posts from Stack Overflow
or by serg555
Published on 2010-04-30T18:24:54Z
Indexed on
2010/04/30
18:27 UTC
Read the original article
Hit count: 118
java
|collections
If I run this operation on List<Integer>
for example, it works as expected (removes first 5 elements), but when I run it on a list of my objects, nothing happens (list stays the same).
list.subList(0, 5).clear();
My class is a pojo that doesn't implement equals
or hashCode
, if that matters.
© Stack Overflow or respective owner