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.
0
votes
Looping over a list, checking a boolean and return value
Have only one exit point from the method. Also, despite being old school, I would iterate using a while loop with a stop condition instead of the for-each.
public boolean checkNamesStartWith(List<Foo …
11
votes
Removing duplicate values from an array
Suggestion:
public static Integer[] removeDuplicates(Integer[] arr) {
return new HashSet<Integer>(Arrays.asList(arr)).toArray(new Integer[0]);
}
Another solution might be:
public static int[] r …
2
votes
FactoryPattern without If-else construct
A static createInstance method would be safer instead of newInstance. Also, agreeing with rai.skumar, I would rather call it Factory Strategy or something similar. But actually I find your idea quite …
2
votes
Displaying an accordion with a list of connections
scroll.getStyleClass().add("stacked-titled-panes-scroll-pane");
scroll.setPrefSize(395, 580);
scroll.setLayoutX(5);
scroll.setLayoutY(32);
these lines can go inside makeScrollable(), which in turn c …
1
vote
1
answer
124
views
Refactoring Java transmitter delegate implementation
I have 3 classes: a transmitter, a view for displaying and a recording view for flushing the screen contents into a file. The view and the recording view classes register themselves from their constru …
1
vote
Is this a correct way to use Factory Pattern?
Note that there isn't a so called factory pattern, there is factory method and there is abstract factory.
I would create a separate factory class for ProjectDateCreator.CREATION and ProjectDateCreati …
2
votes
Accepted
Design Pattern for Swing application
One thing would be to separate view from functionality (you may even make the business logic invocation asynchronous). You can also make your code cleaner and smaller by creating widgets that support …