Skip to content

Instantly share code, notes, and snippets.

@deathbeam
Created August 18, 2015 19:52
Show Gist options
  • Save deathbeam/9997b62d7ec1aa23a9ce to your computer and use it in GitHub Desktop.
Save deathbeam/9997b62d7ec1aa23a9ce to your computer and use it in GitHub Desktop.
MEGAAA
enum Some {
One,
Two,
Three
}
class Thing {
public String name, password, another;
public Some thing;
}
static void main (String... args) {
final Thing thing1 = new Thing();
thing1.name = "abc";
thing1.password = "def";
thing1.another = "ghi";
thing1.thing = Some.One;
final Thing thing2 = new Thing();
thing2.name = "123";
thing2.password = "456";
thing2.another = "789";
thing2.thing = Some.Two;
MyAwesomeList<Thing> things = new MyAwesomeList() {{
add(thing1);
add(thing2);
}}
// return thing2
Thing result1 = things.get("name", "123");
// return false, because we have only Some.One and Some.Two in thing1 and thing2
boolean result2 = things.contains("thing", Some.Three);
// remove thing1 because it have password property with abc value and return true
boolean result3 = things.remove("password", "abc");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment