Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
Java (not to be confused with JavaScript) is a class-based, object-oriented, strongly typed, reflective language and run-time environment (JRE). Java programs are compiled to bytecode and run in a virtual machine (JVM) enabling a "write once, run anywhere" (WORA) methodology.
9
votes
6
answers
21k
views
Many if statements - refactoring [closed]
Yesterday I found some nice video from some IT conference about removing if statements from code. I saw a very nice example of refactoring. I am curious what do you think about it, especially what wea …
6
votes
6
answers
340
views
Long conditionals in ifs [closed]
Very easy question for these who spend some time on analyzing code written by co-workers.
When I write my code, I do my best to write it in a very, extremely readable way. But sometimes I have an im …
1
vote
1
answer
10k
views
Common interface with different return types [closed]
The user can choose a directory and than, application get one of the possible result (examples):
return number of lines in all *.java files
return number of lines in all *.java files without comments …
4
votes
Java code for Linked List
Exactly as already said:
Mixing insert() with append()? Does it make sense? Choose one
You do not accept an empty list.
Here is a turbo-fast example with append() accepting an empty list:
class N …
11
votes
2
answers
2k
views
toString() in a model or view layer?
I would like to ask those of you, who are a little bit more expirienced in development. I would like to ask about toString() method usage. In what situations do you use it?
I've found some info about …
7
votes
4
answers
5k
views
Saving enum value using name()
Let's assume I have an enum type
enum ComponentState {
TURNED_OFF,
TURNED_ON,
SUSPENDED,
TO_REPAIR;
}
This enum describes a state of some component. Now let's assume I want to expor …
2
votes
Checking if an index is out of bounds
Not sure if I've understood yout question correctly, but I assume, that your grid is a square grid (you test both, maximal high and width, as a lower than grid's height).
Referring to your first ques …
2
votes
2
answers
166
views
Retrieving doubles from string - simple problem
The problem is not very complicated (I mean it is easy to solve it), but the question is how to make it in the easiest way (Java)
Input String:
String inputString = "[value=20][param=304.2][indicator … What other (smarter) way would you propose using Java? …
5
votes
1
answer
346
views
Rethrowing exception just as an information
I have something like that:
My custom exception class:
public class SolvableException extends RuntimeException {
protected boolean solved = false;
public SolvableException(String message) …
0
votes
3
answers
822
views
Mixing business logic and presentation layer in enum type
Let's assume I have an enum type with currency:
public enum CurrencyType {
USD("American Dollar", "USD"),
EUR("Euro", "EUR"),
JPY("Japan Yen", "JPY");
private final String fullName; …
4
votes
4
answers
198
views
Reference type and constructors [closed]
Code in Java but should be readable also for c#...
Let's assume I have a class with some reference types. …
4
votes
2
answers
416
views
Wrapper class for adding elements to HashSet
I have many object of class Test. I want to be sure that among them, there are no two objects o1 and o2 where o1==o2. In order to achieve that, I want to add them all to a HashSet and check if hashSet …