api: make HashTable implement iterable

This commit is contained in:
Adam
2021-10-11 19:18:03 -04:00
parent e118ffc06e
commit 5b0acccbc7
2 changed files with 7 additions and 14 deletions

View File

@@ -24,13 +24,11 @@
*/
package net.runelite.api;
import java.util.Collection;
/**
* A data structure that uses a hash function to compute an index into an
* array of buckets from which node objects can be quickly obtained.
*/
public interface HashTable<T extends Node>
public interface HashTable<T extends Node> extends Iterable<T>
{
/**
* Gets a node by its hash value.
@@ -39,11 +37,4 @@ public interface HashTable<T extends Node>
* @return the associated node
*/
T get(long value);
/**
* Gets a collection of all nodes stored in this table.
*
* @return the nodes stored
*/
Collection<T> getNodes();
}

View File

@@ -40,6 +40,7 @@ import lombok.extern.slf4j.Slf4j;
import net.runelite.api.Client;
import net.runelite.api.GameState;
import net.runelite.api.Varbits;
import net.runelite.api.WidgetNode;
import net.runelite.api.coords.WorldPoint;
import net.runelite.api.vars.Autoweed;
import net.runelite.api.widgets.WidgetModalMode;
@@ -101,11 +102,12 @@ public class FarmingTracker
boolean changed = false;
//Varbits don't get sent when a modal widget is open so just return
if (client.getComponentTable().getNodes()
.stream()
.anyMatch(widgetNode -> widgetNode.getModalMode() != WidgetModalMode.NON_MODAL))
for (WidgetNode widgetNode : client.getComponentTable())
{
return false;
if (widgetNode.getModalMode() != WidgetModalMode.NON_MODAL)
{
return false;
}
}
{