From 8491496226272f97e6e20e9825973a4bad12417e Mon Sep 17 00:00:00 2001 From: Ray Greenwell Date: Thu, 24 Feb 2005 06:52:09 +0000 Subject: [PATCH] Actually, it was stupid of me to handle a non-RandomAccess list differently, as they still implement get() and however they do that internally is bound to be more efficient than doing the same thing through an Iterator. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3367 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- src/java/com/threerings/util/RandomUtil.java | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/java/com/threerings/util/RandomUtil.java b/src/java/com/threerings/util/RandomUtil.java index c1521f446..238840de4 100644 --- a/src/java/com/threerings/util/RandomUtil.java +++ b/src/java/com/threerings/util/RandomUtil.java @@ -24,7 +24,6 @@ package com.threerings.util; import java.util.Iterator; import java.util.List; import java.util.Random; -import java.util.RandomAccess; import com.samskivert.util.IntListUtil; @@ -152,10 +151,6 @@ public class RandomUtil public static Object pickRandom (List values) { int size = values.size(); - if (!(values instanceof RandomAccess)) { - return pickRandom(values.iterator(), size); - } - if (size == 0) { throw new IllegalArgumentException( "Must have at least one element [size=" + size + "]"); @@ -173,10 +168,6 @@ public class RandomUtil public static Object pickRandom (List values, Object skip) { int size = values.size(); - if (!(values instanceof RandomAccess)) { - return pickRandom(values.iterator(), size, skip); - } - if (size < 2) { throw new IllegalArgumentException( "Must have at least one element [size=" + size + "]");