Skip to main content
11 events
when toggle format what by license comment
May 23, 2017 at 12:41 history edited CommunityBot
replaced http://stackoverflow.com/ with https://stackoverflow.com/
Apr 27, 2014 at 14:21 comment added Simon Forsberg Ah, OK. That explains the difference!
Apr 27, 2014 at 14:20 comment added Ingo Bürk @SimonAndréForsberg I was using Guava's Optional API. Unfortunately, Java 8 did sort of a half-assed job on the new APIs (imho).
Apr 27, 2014 at 13:29 comment added Simon Forsberg A minor minor note: I couldn't find any orNull method, I guess orElse(null) should be used? And the same for orElse(defaultMonster). I happened to have use for some Optional things as well :)
Apr 27, 2014 at 12:19 history edited Ingo Bürk CC BY-SA 3.0
typo
Apr 27, 2014 at 12:19 review First posts
Apr 27, 2014 at 13:38
Apr 27, 2014 at 12:15 comment added Ingo Bürk @SimonAndréForsberg D'oh, my bad. I usually stick with Lists, but in a fixed-size scenario an array makes sense. :) Using a common array isn't too bad here anyway, I edited the answer accordingly.
Apr 27, 2014 at 12:13 comment added skiwi Fair points on most cases, few notes: 1) I intend the calling class (for example from within a GUI) to know about which monsters are where, therefore I do not expect the calling code to ever encounter null if designed properly, hence some of my design decisions; 2) I'm explicitely defining Field field = new Field(6) everywhere, because the 6 argument is relevant for testing bounds. Overall a very good answer.
Apr 27, 2014 at 12:10 comment added Simon Forsberg Overall, this is a great answer. Welcome to Code Review! One note though, Optional<MonsterCard>[] is problematic since such an array can not be created because it is of a generic type.
Apr 27, 2014 at 12:05 history edited Ingo Bürk CC BY-SA 3.0
added 352 characters in body
Apr 27, 2014 at 11:59 history answered Ingo Bürk CC BY-SA 3.0