From ca817e4e119233f9fd542bcb51729e4bbbd2cb27 Mon Sep 17 00:00:00 2001 From: TomyLobo Date: Mon, 23 Jan 2012 03:18:41 +0100 Subject: [PATCH] Optimized BaseBlock.inIterable a bit. --- src/main/java/com/sk89q/worldedit/blocks/BaseBlock.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/com/sk89q/worldedit/blocks/BaseBlock.java b/src/main/java/com/sk89q/worldedit/blocks/BaseBlock.java index cdf2142ca..81b43926b 100644 --- a/src/main/java/com/sk89q/worldedit/blocks/BaseBlock.java +++ b/src/main/java/com/sk89q/worldedit/blocks/BaseBlock.java @@ -19,6 +19,8 @@ package com.sk89q.worldedit.blocks; +import java.util.Collection; + import com.sk89q.worldedit.CuboidClipboard.FlipDirection; /** @@ -162,6 +164,10 @@ public class BaseBlock { } public boolean inIterable(Iterable iter) { + if (iter instanceof Collection) { + return ((Collection) iter).contains(this); + } + for (BaseBlock block : iter) { if (block.equals(this)) { return true;