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 | |
Results tagged with java
Search options not deleted user 31101
Java is a high-level, platform-independent, object-oriented programming language originally developed by Sun Microsystems. Java is currently owned by Oracle, which purchased Sun in 2010.
2 votes
1 answer
1k views
Best practice for allowing mutation of a Collection type field
Suppose I have a (DTO style) class with a field that is a list: public class MyClass { private List<String> stuff = new LinkedList<>(); } There are a few choices to allow mutation of the field: …
2 votes
Design Patterns (java) -- Strategy with fields. Ever acceptable?
In your example of the horse prediction strategy, you have mixed strategy and history analysis. The solution is to record the horse history somewhere else, and simply replace the existing strategy wi …
11 votes
Does the Decorator Pattern exist in the Java IO classes?
The decorator pattern applies here because BufferedReader wraps a Reader - it's still a Reader (it has all the methods of Reader), but it has more "bells and whistles" (more methods). Here's an examp …
28 votes
In Java, should I use "final" for parameters and locals even when I don't have to?
Java method declarations can be quite long (especially with generics) - there's no need to make them any longer. …
24 votes
Advantages and Disadvantages of Forced Code Reformat
I think it's very important to do this. Here's why: It makes your source control diffs show just actual code changes, and all but eliminates "diff noise" due to whitespace and other insignificant fo …
11 votes
3 answers
12k views
Is enum order sensitivity an antipattern?
Is it an anti-pattern to depend on a particular order of an enum's instance declarations? For example, consider: public enum CompassPoint { North, East, South, West; } These points …
7 votes
1 answer
3k views
What the fastest way to pass large data between JVMs?
I have 2 JVMs on the same machine that I want to pass about 1Mb of (serializable) data between ideally in under 5 ms. Under load, using HTTP to localhost takes about 70ms average. I tried hazelcast, …
59 votes
3 answers
43k views
Is it an antipattern to use peek() to modify a stream element?
Suppose I have a stream of Things and I want to "enrich" them mid stream, I can use peek() to do this, eg: streamOfThings.peek(this::thingMutator).forEach(this::someConsumer); Assume that mutating th …