Created
August 18, 2015 19:52
-
-
Save deathbeam/9997b62d7ec1aa23a9ce to your computer and use it in GitHub Desktop.
MEGAAA
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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