Timeline for Improve my if-statement to prevent double checks
Current License: CC BY-SA 3.0
10 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Nov 19, 2013 at 9:33 | history | edited | Adam Siemion | CC BY-SA 3.0 |
deleted 9 characters in body
|
Nov 18, 2013 at 12:33 | comment | added | Simon Forsberg |
The OP said they were ArrayLists , not arrays. String[] should be List<String> , and the method can actually be built with generics to support any kind of list. I'll add an answer to show how.
|
|
Nov 18, 2013 at 11:18 | comment | added | Adam Siemion |
@tintinmj Arrays.toString() adds , , [ and ] to the output, something that OP does not want.
|
|
Nov 18, 2013 at 10:58 | comment | added | Anirban Nag 'tintinmj' |
I think the whole code block inside getArrayContent method can be substituted with return array.isEmpty() ? "-" : Arrays.toString(array);
|
|
Nov 18, 2013 at 9:02 | vote | accept | Michael Schmidt | ||
Nov 18, 2013 at 9:02 | comment | added | Michael Schmidt | This is why I love this site. very elegant way. Thanks! | |
Nov 18, 2013 at 8:45 | history | edited | Adam Siemion | CC BY-SA 3.0 |
added 4 characters in body
|
Nov 18, 2013 at 8:44 | comment | added | ChrisWue |
You mean if (!array.isEmpty())
|
|
Nov 18, 2013 at 8:35 | history | edited | Adam Siemion | CC BY-SA 3.0 |
deleted 2 characters in body
|
Nov 18, 2013 at 8:29 | history | answered | Adam Siemion | CC BY-SA 3.0 |