Skip to main content
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
Results tagged with
Search options not deleted user 21707

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 …
András Hummer's user avatar
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 …
András Hummer's user avatar
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 …
András Hummer's user avatar
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 …
András Hummer's user avatar
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 …
András Hummer's user avatar
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 …
András Hummer's user avatar
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 …
András Hummer's user avatar