Switch case implementation in Java for an integer pair combinationasMap-implementation for Java (based on...
Eww, those bytes are gross
How can I prevent an oracle who can see into the past from knowing everything that has happened?
Website seeing my Facebook data?
Not a Long-Winded Riddle
Translation needed for 130 years old church document
Can we "borrow" our answers to populate our own websites?
Are the positive and negative planes inner or outer planes in the Great Wheel cosmology model?
A question about partitioning positivie integers into finitely many arithmetic progresions
Article. The word "Respect"
How big is a framed opening for a door relative to the finished door opening width?
If angels and devils are the same species, why would their mortal offspring appear physically different?
Why does 0.-5 evaluate to -5?
Critique vs nitpicking
How do you get out of your own psychology to write characters?
What's the oldest plausible frozen specimen for a Jurassic Park style story-line?
What can I do to encourage my players to use their consumables?
What is a good reason for every spaceship to carry a weapon on board?
Why did Mr. Elliot have to decide whose boots were thickest in "Persuasion"?
Sitecore 9.1 Installation - Skip to particular step
What to do with threats of blacklisting?
Coworker asking me to not bring cakes due to self control issue. What should I do?
Count repetitions of an array
What species should be used for storage of human minds?
Is there any danger of my neighbor having my wife's signature?
Switch case implementation in Java for an integer pair combination
asMap-implementation for Java (based on Arrays.asList)Optimizing code block using Switch CaseRefactoring switch case statement in different classesInteger quicksort in JavaCombination generator in JavaCombination generator in Java - 2nd iterationCalculating pair combinations in JavaBinary Search Implementation for Integer ArraySwitch-like functionality for non-switchable types in JavaJava implementation of well-separated pair decomposition
$begingroup$
I have following Python code:
def get_subject_from_stream_id_and_subject_id(stream_id, subject_id):
#(stream_id, subject_id): ("subject_name")
return {
(1, 1): "Accounts",
(1, 2): "English",
(1, 3): "Organization of Commerce",
(2, 1): "Physics",
(2, 2): "English",
(2, 3): "Biology"
}.get((stream_id, subject_id), "None")
In this code, I want to get subject name from the integer pair combination i.e. stream_id, subject_id e.g. (1, 2) is for English. It was implemented using a Python tuple.
I want to implement the same piece of code in Java.
Could someone write this in a better way in Java?
public String getSubjectFromStreamIdAndSubjectId(int streamId, int subjectId) {
switch (streamId) {
case 1:
switch (subjectId) {
case 1:
return "Accounts";
case 2:
return "English";
case 3:
return "Organization of Commerce";
default:
return null;
}
case 2:
switch (subjectId) {
case 1:
return "Physics";
case 2:
return "English";
case 3:
return "Biology";
default:
return null;
}
default:
return null;
}
}
java
New contributor
Edge Goldberg is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
$endgroup$
add a comment |
$begingroup$
I have following Python code:
def get_subject_from_stream_id_and_subject_id(stream_id, subject_id):
#(stream_id, subject_id): ("subject_name")
return {
(1, 1): "Accounts",
(1, 2): "English",
(1, 3): "Organization of Commerce",
(2, 1): "Physics",
(2, 2): "English",
(2, 3): "Biology"
}.get((stream_id, subject_id), "None")
In this code, I want to get subject name from the integer pair combination i.e. stream_id, subject_id e.g. (1, 2) is for English. It was implemented using a Python tuple.
I want to implement the same piece of code in Java.
Could someone write this in a better way in Java?
public String getSubjectFromStreamIdAndSubjectId(int streamId, int subjectId) {
switch (streamId) {
case 1:
switch (subjectId) {
case 1:
return "Accounts";
case 2:
return "English";
case 3:
return "Organization of Commerce";
default:
return null;
}
case 2:
switch (subjectId) {
case 1:
return "Physics";
case 2:
return "English";
case 3:
return "Biology";
default:
return null;
}
default:
return null;
}
}
java
New contributor
Edge Goldberg is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
$endgroup$
$begingroup$
That doesn't look like syntactically valid Java code.
$endgroup$
– 200_success
7 hours ago
$begingroup$
It's lacking method parameter types. Otherwise it compiles just great.
$endgroup$
– TorbenPutkonen
6 hours ago
$begingroup$
@200_success I updated it
$endgroup$
– Edge Goldberg
5 hours ago
add a comment |
$begingroup$
I have following Python code:
def get_subject_from_stream_id_and_subject_id(stream_id, subject_id):
#(stream_id, subject_id): ("subject_name")
return {
(1, 1): "Accounts",
(1, 2): "English",
(1, 3): "Organization of Commerce",
(2, 1): "Physics",
(2, 2): "English",
(2, 3): "Biology"
}.get((stream_id, subject_id), "None")
In this code, I want to get subject name from the integer pair combination i.e. stream_id, subject_id e.g. (1, 2) is for English. It was implemented using a Python tuple.
I want to implement the same piece of code in Java.
Could someone write this in a better way in Java?
public String getSubjectFromStreamIdAndSubjectId(int streamId, int subjectId) {
switch (streamId) {
case 1:
switch (subjectId) {
case 1:
return "Accounts";
case 2:
return "English";
case 3:
return "Organization of Commerce";
default:
return null;
}
case 2:
switch (subjectId) {
case 1:
return "Physics";
case 2:
return "English";
case 3:
return "Biology";
default:
return null;
}
default:
return null;
}
}
java
New contributor
Edge Goldberg is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
$endgroup$
I have following Python code:
def get_subject_from_stream_id_and_subject_id(stream_id, subject_id):
#(stream_id, subject_id): ("subject_name")
return {
(1, 1): "Accounts",
(1, 2): "English",
(1, 3): "Organization of Commerce",
(2, 1): "Physics",
(2, 2): "English",
(2, 3): "Biology"
}.get((stream_id, subject_id), "None")
In this code, I want to get subject name from the integer pair combination i.e. stream_id, subject_id e.g. (1, 2) is for English. It was implemented using a Python tuple.
I want to implement the same piece of code in Java.
Could someone write this in a better way in Java?
public String getSubjectFromStreamIdAndSubjectId(int streamId, int subjectId) {
switch (streamId) {
case 1:
switch (subjectId) {
case 1:
return "Accounts";
case 2:
return "English";
case 3:
return "Organization of Commerce";
default:
return null;
}
case 2:
switch (subjectId) {
case 1:
return "Physics";
case 2:
return "English";
case 3:
return "Biology";
default:
return null;
}
default:
return null;
}
}
java
java
New contributor
Edge Goldberg is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Edge Goldberg is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
edited 1 hour ago
200_success
129k15153417
129k15153417
New contributor
Edge Goldberg is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
asked 7 hours ago
Edge GoldbergEdge Goldberg
212
212
New contributor
Edge Goldberg is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Edge Goldberg is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Edge Goldberg is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
$begingroup$
That doesn't look like syntactically valid Java code.
$endgroup$
– 200_success
7 hours ago
$begingroup$
It's lacking method parameter types. Otherwise it compiles just great.
$endgroup$
– TorbenPutkonen
6 hours ago
$begingroup$
@200_success I updated it
$endgroup$
– Edge Goldberg
5 hours ago
add a comment |
$begingroup$
That doesn't look like syntactically valid Java code.
$endgroup$
– 200_success
7 hours ago
$begingroup$
It's lacking method parameter types. Otherwise it compiles just great.
$endgroup$
– TorbenPutkonen
6 hours ago
$begingroup$
@200_success I updated it
$endgroup$
– Edge Goldberg
5 hours ago
$begingroup$
That doesn't look like syntactically valid Java code.
$endgroup$
– 200_success
7 hours ago
$begingroup$
That doesn't look like syntactically valid Java code.
$endgroup$
– 200_success
7 hours ago
$begingroup$
It's lacking method parameter types. Otherwise it compiles just great.
$endgroup$
– TorbenPutkonen
6 hours ago
$begingroup$
It's lacking method parameter types. Otherwise it compiles just great.
$endgroup$
– TorbenPutkonen
6 hours ago
$begingroup$
@200_success I updated it
$endgroup$
– Edge Goldberg
5 hours ago
$begingroup$
@200_success I updated it
$endgroup$
– Edge Goldberg
5 hours ago
add a comment |
3 Answers
3
active
oldest
votes
$begingroup$
Java equivalent of the above Python code goes more like this:
private static final Map<List<Integer>, String> SUBJECT_MAP = createSubjectMap();
private static Map<List<Integer>, String> createSubjectMap() {
Map<List<Integer>, String> map = new HashMap<>();
map.put(asList(1, 1), "Accounts");
map.put(asList(1, 2), "English");
map.put(asList(1, 3), "Organization of Commerce");
map.put(asList(2, 1), "Physics");
map.put(asList(2, 2), "English");
map.put(asList(2, 3), "Biology");
return map;
}
public static String getSubjectFromStreamIdAndSubjectId(int streamId, int subjectId) {
return SUBJECT_MAP.get(asList(streamId, subjectId));
}
$endgroup$
$begingroup$
Might be better to use a customSubjectIdentifierclass since aListseems rather inefficient.
$endgroup$
– rath
2 hours ago
add a comment |
$begingroup$
Neither is good, but surely we can all agree that the Java example is way uglier. The biggest problem, however, is that both examples hard code data into code.
Separate data, i.e. stream and subject IDs and their titles into a data class and in that class implement code that accesses the data structure without detailed knowledge about the actual data. Responsibility of setting up the data structure to resemble your stream and subject numbering is left to a separate component (load it from file or set up in static code).
Whether the data class is a recursive structure or just a wrapper for a HashMap depends on the complexity of your data.
$endgroup$
add a comment |
$begingroup$
When something is difficult in Java it's nearly always because there is a better way to do it (in Java, it generally means you are missing a class). In your case, it looks like you need a "Subject" class.
Let's say you had a "Subject" class, how would it be implemented? Here's one way (Not my favorite)
enum Subject {
Accounts(1,1),
English(1,2),
…;
public static Subject getSubject(streamId, subjectId) {
// Iterate over Subject.values and return one that matches
}
This means that your call becomes simple:
assertEquals(Subjects.Accounts, Subject.getSubject(1,1));
I don't completely love this because it's still hard-coded. I would personally make the Subjects class a full class and load it from either a database or a data file, but it should still have a getSubject() static.
Just in case you think there is some kind of performance issue caused by looping instead of a switch, note that A) java is 10x faster than python to start and B) premature optimization is the root of all evil (well, lots of evil)
$endgroup$
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
return StackExchange.using("mathjaxEditing", function () {
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["\$", "\$"]]);
});
});
}, "mathjax-editing");
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "196"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Edge Goldberg is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f214234%2fswitch-case-implementation-in-java-for-an-integer-pair-combination%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
$begingroup$
Java equivalent of the above Python code goes more like this:
private static final Map<List<Integer>, String> SUBJECT_MAP = createSubjectMap();
private static Map<List<Integer>, String> createSubjectMap() {
Map<List<Integer>, String> map = new HashMap<>();
map.put(asList(1, 1), "Accounts");
map.put(asList(1, 2), "English");
map.put(asList(1, 3), "Organization of Commerce");
map.put(asList(2, 1), "Physics");
map.put(asList(2, 2), "English");
map.put(asList(2, 3), "Biology");
return map;
}
public static String getSubjectFromStreamIdAndSubjectId(int streamId, int subjectId) {
return SUBJECT_MAP.get(asList(streamId, subjectId));
}
$endgroup$
$begingroup$
Might be better to use a customSubjectIdentifierclass since aListseems rather inefficient.
$endgroup$
– rath
2 hours ago
add a comment |
$begingroup$
Java equivalent of the above Python code goes more like this:
private static final Map<List<Integer>, String> SUBJECT_MAP = createSubjectMap();
private static Map<List<Integer>, String> createSubjectMap() {
Map<List<Integer>, String> map = new HashMap<>();
map.put(asList(1, 1), "Accounts");
map.put(asList(1, 2), "English");
map.put(asList(1, 3), "Organization of Commerce");
map.put(asList(2, 1), "Physics");
map.put(asList(2, 2), "English");
map.put(asList(2, 3), "Biology");
return map;
}
public static String getSubjectFromStreamIdAndSubjectId(int streamId, int subjectId) {
return SUBJECT_MAP.get(asList(streamId, subjectId));
}
$endgroup$
$begingroup$
Might be better to use a customSubjectIdentifierclass since aListseems rather inefficient.
$endgroup$
– rath
2 hours ago
add a comment |
$begingroup$
Java equivalent of the above Python code goes more like this:
private static final Map<List<Integer>, String> SUBJECT_MAP = createSubjectMap();
private static Map<List<Integer>, String> createSubjectMap() {
Map<List<Integer>, String> map = new HashMap<>();
map.put(asList(1, 1), "Accounts");
map.put(asList(1, 2), "English");
map.put(asList(1, 3), "Organization of Commerce");
map.put(asList(2, 1), "Physics");
map.put(asList(2, 2), "English");
map.put(asList(2, 3), "Biology");
return map;
}
public static String getSubjectFromStreamIdAndSubjectId(int streamId, int subjectId) {
return SUBJECT_MAP.get(asList(streamId, subjectId));
}
$endgroup$
Java equivalent of the above Python code goes more like this:
private static final Map<List<Integer>, String> SUBJECT_MAP = createSubjectMap();
private static Map<List<Integer>, String> createSubjectMap() {
Map<List<Integer>, String> map = new HashMap<>();
map.put(asList(1, 1), "Accounts");
map.put(asList(1, 2), "English");
map.put(asList(1, 3), "Organization of Commerce");
map.put(asList(2, 1), "Physics");
map.put(asList(2, 2), "English");
map.put(asList(2, 3), "Biology");
return map;
}
public static String getSubjectFromStreamIdAndSubjectId(int streamId, int subjectId) {
return SUBJECT_MAP.get(asList(streamId, subjectId));
}
edited 1 hour ago
mdfst13
17.8k62157
17.8k62157
answered 4 hours ago
abuzittin gillifircaabuzittin gillifirca
5,907924
5,907924
$begingroup$
Might be better to use a customSubjectIdentifierclass since aListseems rather inefficient.
$endgroup$
– rath
2 hours ago
add a comment |
$begingroup$
Might be better to use a customSubjectIdentifierclass since aListseems rather inefficient.
$endgroup$
– rath
2 hours ago
$begingroup$
Might be better to use a custom
SubjectIdentifier class since a List seems rather inefficient.$endgroup$
– rath
2 hours ago
$begingroup$
Might be better to use a custom
SubjectIdentifier class since a List seems rather inefficient.$endgroup$
– rath
2 hours ago
add a comment |
$begingroup$
Neither is good, but surely we can all agree that the Java example is way uglier. The biggest problem, however, is that both examples hard code data into code.
Separate data, i.e. stream and subject IDs and their titles into a data class and in that class implement code that accesses the data structure without detailed knowledge about the actual data. Responsibility of setting up the data structure to resemble your stream and subject numbering is left to a separate component (load it from file or set up in static code).
Whether the data class is a recursive structure or just a wrapper for a HashMap depends on the complexity of your data.
$endgroup$
add a comment |
$begingroup$
Neither is good, but surely we can all agree that the Java example is way uglier. The biggest problem, however, is that both examples hard code data into code.
Separate data, i.e. stream and subject IDs and their titles into a data class and in that class implement code that accesses the data structure without detailed knowledge about the actual data. Responsibility of setting up the data structure to resemble your stream and subject numbering is left to a separate component (load it from file or set up in static code).
Whether the data class is a recursive structure or just a wrapper for a HashMap depends on the complexity of your data.
$endgroup$
add a comment |
$begingroup$
Neither is good, but surely we can all agree that the Java example is way uglier. The biggest problem, however, is that both examples hard code data into code.
Separate data, i.e. stream and subject IDs and their titles into a data class and in that class implement code that accesses the data structure without detailed knowledge about the actual data. Responsibility of setting up the data structure to resemble your stream and subject numbering is left to a separate component (load it from file or set up in static code).
Whether the data class is a recursive structure or just a wrapper for a HashMap depends on the complexity of your data.
$endgroup$
Neither is good, but surely we can all agree that the Java example is way uglier. The biggest problem, however, is that both examples hard code data into code.
Separate data, i.e. stream and subject IDs and their titles into a data class and in that class implement code that accesses the data structure without detailed knowledge about the actual data. Responsibility of setting up the data structure to resemble your stream and subject numbering is left to a separate component (load it from file or set up in static code).
Whether the data class is a recursive structure or just a wrapper for a HashMap depends on the complexity of your data.
edited 59 mins ago
mdfst13
17.8k62157
17.8k62157
answered 6 hours ago
TorbenPutkonenTorbenPutkonen
25518
25518
add a comment |
add a comment |
$begingroup$
When something is difficult in Java it's nearly always because there is a better way to do it (in Java, it generally means you are missing a class). In your case, it looks like you need a "Subject" class.
Let's say you had a "Subject" class, how would it be implemented? Here's one way (Not my favorite)
enum Subject {
Accounts(1,1),
English(1,2),
…;
public static Subject getSubject(streamId, subjectId) {
// Iterate over Subject.values and return one that matches
}
This means that your call becomes simple:
assertEquals(Subjects.Accounts, Subject.getSubject(1,1));
I don't completely love this because it's still hard-coded. I would personally make the Subjects class a full class and load it from either a database or a data file, but it should still have a getSubject() static.
Just in case you think there is some kind of performance issue caused by looping instead of a switch, note that A) java is 10x faster than python to start and B) premature optimization is the root of all evil (well, lots of evil)
$endgroup$
add a comment |
$begingroup$
When something is difficult in Java it's nearly always because there is a better way to do it (in Java, it generally means you are missing a class). In your case, it looks like you need a "Subject" class.
Let's say you had a "Subject" class, how would it be implemented? Here's one way (Not my favorite)
enum Subject {
Accounts(1,1),
English(1,2),
…;
public static Subject getSubject(streamId, subjectId) {
// Iterate over Subject.values and return one that matches
}
This means that your call becomes simple:
assertEquals(Subjects.Accounts, Subject.getSubject(1,1));
I don't completely love this because it's still hard-coded. I would personally make the Subjects class a full class and load it from either a database or a data file, but it should still have a getSubject() static.
Just in case you think there is some kind of performance issue caused by looping instead of a switch, note that A) java is 10x faster than python to start and B) premature optimization is the root of all evil (well, lots of evil)
$endgroup$
add a comment |
$begingroup$
When something is difficult in Java it's nearly always because there is a better way to do it (in Java, it generally means you are missing a class). In your case, it looks like you need a "Subject" class.
Let's say you had a "Subject" class, how would it be implemented? Here's one way (Not my favorite)
enum Subject {
Accounts(1,1),
English(1,2),
…;
public static Subject getSubject(streamId, subjectId) {
// Iterate over Subject.values and return one that matches
}
This means that your call becomes simple:
assertEquals(Subjects.Accounts, Subject.getSubject(1,1));
I don't completely love this because it's still hard-coded. I would personally make the Subjects class a full class and load it from either a database or a data file, but it should still have a getSubject() static.
Just in case you think there is some kind of performance issue caused by looping instead of a switch, note that A) java is 10x faster than python to start and B) premature optimization is the root of all evil (well, lots of evil)
$endgroup$
When something is difficult in Java it's nearly always because there is a better way to do it (in Java, it generally means you are missing a class). In your case, it looks like you need a "Subject" class.
Let's say you had a "Subject" class, how would it be implemented? Here's one way (Not my favorite)
enum Subject {
Accounts(1,1),
English(1,2),
…;
public static Subject getSubject(streamId, subjectId) {
// Iterate over Subject.values and return one that matches
}
This means that your call becomes simple:
assertEquals(Subjects.Accounts, Subject.getSubject(1,1));
I don't completely love this because it's still hard-coded. I would personally make the Subjects class a full class and load it from either a database or a data file, but it should still have a getSubject() static.
Just in case you think there is some kind of performance issue caused by looping instead of a switch, note that A) java is 10x faster than python to start and B) premature optimization is the root of all evil (well, lots of evil)
edited 30 mins ago
answered 37 mins ago
Bill KBill K
33117
33117
add a comment |
add a comment |
Edge Goldberg is a new contributor. Be nice, and check out our Code of Conduct.
Edge Goldberg is a new contributor. Be nice, and check out our Code of Conduct.
Edge Goldberg is a new contributor. Be nice, and check out our Code of Conduct.
Edge Goldberg is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to Code Review Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
Use MathJax to format equations. MathJax reference.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f214234%2fswitch-case-implementation-in-java-for-an-integer-pair-combination%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
$begingroup$
That doesn't look like syntactically valid Java code.
$endgroup$
– 200_success
7 hours ago
$begingroup$
It's lacking method parameter types. Otherwise it compiles just great.
$endgroup$
– TorbenPutkonen
6 hours ago
$begingroup$
@200_success I updated it
$endgroup$
– Edge Goldberg
5 hours ago