diff --git a/src/main/java/com/samskivert/util/Randoms.java b/src/main/java/com/samskivert/util/Randoms.java index 1f14ea99..2ebb7dd1 100644 --- a/src/main/java/com/samskivert/util/Randoms.java +++ b/src/main/java/com/samskivert/util/Randoms.java @@ -223,6 +223,7 @@ public class Randoms /** * Shared code for pick and pluck. */ + @SuppressWarnings("unchecked") protected T pickPluck (Iterable iterable, T ifEmpty, boolean remove) { if (iterable instanceof Collection) { @@ -236,7 +237,7 @@ public class Randoms // extra-special optimized path for Lists List list = (List)coll; int idx = _r.nextInt(size); - return remove ? list.remove(idx) : list.get(idx); + return (T) (remove ? list.remove(idx) : list.get(idx)); } // for other Collections, we must iterate Iterator it = coll.iterator();