Revert the meat of r2908.
Maybe mdb is using a newer compiler that is behaving correctly, but my 1.6 freaks out without these. git-svn-id: https://samskivert.googlecode.com/svn/trunk@2910 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
@@ -223,6 +223,7 @@ public class Randoms
|
|||||||
/**
|
/**
|
||||||
* Shared code for pick and pluck.
|
* Shared code for pick and pluck.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
protected <T> T pickPluck (Iterable<? extends T> iterable, T ifEmpty, boolean remove)
|
protected <T> T pickPluck (Iterable<? extends T> iterable, T ifEmpty, boolean remove)
|
||||||
{
|
{
|
||||||
if (iterable instanceof Collection) {
|
if (iterable instanceof Collection) {
|
||||||
@@ -236,7 +237,7 @@ public class Randoms
|
|||||||
// extra-special optimized path for Lists
|
// extra-special optimized path for Lists
|
||||||
List<? extends T> list = (List<? extends T>)coll;
|
List<? extends T> list = (List<? extends T>)coll;
|
||||||
int idx = _r.nextInt(size);
|
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
|
// for other Collections, we must iterate
|
||||||
Iterator<? extends T> it = coll.iterator();
|
Iterator<? extends T> it = coll.iterator();
|
||||||
|
|||||||
Reference in New Issue
Block a user