From bdda88cd45d904e170a29b638fae26f9df85f621 Mon Sep 17 00:00:00 2001 From: "ray.j.greenwell" Date: Tue, 24 Nov 2009 20:34:44 +0000 Subject: [PATCH] Actually, let's go ahead and NPE or CCE in remove() and contains() if the specified object is not an Integer. We're allowed to do that per the Collection interface spec, and ArrayIntSet previously had that behavior (but the IntMap keySets did not...). git-svn-id: https://samskivert.googlecode.com/svn/trunk@2651 6335cc39-0255-0410-8fd6-9bcaacd3b74c --- src/java/com/samskivert/util/AbstractIntSet.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/java/com/samskivert/util/AbstractIntSet.java b/src/java/com/samskivert/util/AbstractIntSet.java index f272112c..0fab42e5 100644 --- a/src/java/com/samskivert/util/AbstractIntSet.java +++ b/src/java/com/samskivert/util/AbstractIntSet.java @@ -93,7 +93,8 @@ public abstract class AbstractIntSet extends AbstractSet @Override // from AbstractSet public boolean contains (Object o) { - return (o instanceof Integer) && contains(((Integer)o).intValue()); + // let's go ahead and NPE or CCE if an Integer is not specified + return /* (o instanceof Integer) && */ contains(((Integer)o).intValue()); } @Override // from AbstractSet @@ -105,7 +106,8 @@ public abstract class AbstractIntSet extends AbstractSet @Override // from AbstractSet public boolean remove (Object o) { - return (o instanceof Integer) && remove(((Integer)o).intValue()); + // let's go ahead and NPE or CCE if an Integer is not specified + return /* (o instanceof Integer) && */ remove(((Integer)o).intValue()); } @Override // from AbstractSet