-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBucket.java
More file actions
27 lines (22 loc) · 765 Bytes
/
Copy pathBucket.java
File metadata and controls
27 lines (22 loc) · 765 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/*
George Zhang
Bucket class (map of lambdas).
*/
package geetransit.minecraft05.engine;
import java.util.*;
public class Bucket {
public final Map<String, Runnable> next;
public Bucket() { this.next = new HashMap<>(); }
public boolean run(String string) {
Runnable runnable = this.remove(string);
if (runnable == null)
return false;
runnable.run();
return true;
}
public boolean contains(String string) { return this.next.containsKey(string); }
public Runnable remove(String string) { return this.next.remove(string); }
public boolean empty() { return this.next.isEmpty(); }
public Bucket add(String string, Runnable runnable) { this.next.put(string, runnable); return this; }
public String toString() { return this.next.toString(); }
}