From b51cdf3dfaa528219e953d82c00da16c83c67cf2 Mon Sep 17 00:00:00 2001 From: Ray Greenwell Date: Wed, 27 May 2009 17:29:08 +0000 Subject: [PATCH] Stop me if this Iterator needs to support remove(). I don't think it does. Lets make the samskivert Predicate obsolete. This code would be slightly more efficient (but also obnoxious) if we iterated over the entrySet and then transformed the filtered entries into just keys. git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@825 ed5b42cb-e716-0410-a449-f6a68f950b19 --- .../cast/bundle/BundledComponentRepository.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/java/com/threerings/cast/bundle/BundledComponentRepository.java b/src/java/com/threerings/cast/bundle/BundledComponentRepository.java index a613407e..78db2cdf 100644 --- a/src/java/com/threerings/cast/bundle/BundledComponentRepository.java +++ b/src/java/com/threerings/cast/bundle/BundledComponentRepository.java @@ -32,13 +32,14 @@ import java.awt.Graphics2D; import java.awt.Rectangle; import java.awt.image.BufferedImage; +import com.google.common.base.Predicate; +import com.google.common.collect.Iterators; import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.samskivert.util.IntIntMap; import com.samskivert.util.IntMap; import com.samskivert.util.IntMaps; -import com.samskivert.util.Predicate; import com.samskivert.util.Tuple; import com.threerings.util.DirectionCodes; @@ -225,13 +226,13 @@ public class BundledComponentRepository // documentation inherited public Iterator enumerateComponentIds (final ComponentClass compClass) { - return new Predicate() { + return Iterators.filter(_components.keySet().iterator(), new Predicate() { @Override - public boolean isMatch (Integer input) { + public boolean apply (Integer input) { CharacterComponent comp = _components.get(input); return comp.componentClass.equals(compClass); } - }.filter(_components.keySet().iterator()); + }); } /**