diff --git a/src/main/java/com/samskivert/util/Randoms.java b/src/main/java/com/samskivert/util/Randoms.java index f8bf7e50..69ddd385 100644 --- a/src/main/java/com/samskivert/util/Randoms.java +++ b/src/main/java/com/samskivert/util/Randoms.java @@ -3,7 +3,7 @@ // // samskivert library - useful routines for java programs // Copyright (C) 2001-2010 Michael Bayne, et al. -// +// // This library is free software; you can redistribute it and/or modify it // under the terms of the GNU Lesser General Public License as published // by the Free Software Foundation; either version 2.1 of the License, or @@ -99,7 +99,7 @@ public class Randoms { return _r.nextFloat() * high; } - + /** * Returns a pseudorandom, uniformly distributed float value between * low (inclusive) and high (exclusive). @@ -223,9 +223,8 @@ public class Randoms /** * Shared code for pick and pluck. */ - @SuppressWarnings("unchecked") protected T pickPluck (Iterable iterable, T ifEmpty, boolean remove) - { + { if (iterable instanceof Collection) { // optimized path for Collection Collection coll = (Collection)iterable; @@ -237,7 +236,7 @@ public class Randoms // extra-special optimized path for Lists List list = (List)coll; int idx = _r.nextInt(size); - return (T)(remove ? list.remove(idx) : list.get(idx)); + return remove ? list.remove(idx) : list.get(idx); } // for other Collections, we must iterate Iterator it = coll.iterator();