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 29020
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
2 answers
3k views
Generic decorator implementation
Can this be done in Java? If it is not possible to implement this pattern in Java, is there an elegant way to implement it in another language? …
21 votes
Why do we study Java at university?
I studied Computer Science during the early nineties right before Java came out. The approach followed by our professors was the following. … Going back to the question of teaching Java. …
1 vote
Can a recursive function have iterations/loops?
In imperative languages like C, C++, Java, etc. you normally use a while or for loop when you do not need a stack, and you use recursive calls when you need a stack (you implicitly use the run-time stack …
49 votes
Accepted
Why null pointer instead of class cast?
When executing your code, the Java runtime does the following: Cast null to an object of class Integer. …
0 votes
I can't remember programming 5 mins after learning?
My advice is that you find yourself a small but concrete project. If you want to practice if statements, implementing some kind of classification quiz could be a good excercise: the program asks the u …
3 votes
Single method with many parameters vs many methods that must be called in order
Have you considered using some kind of currying? Imagine that you have a class Processee and a class Processor: class Processor { private final Processee _processee; public Processor(Process …
1 vote
difference between expected inputs and implementation details
The signature of a method is the interface to the callers of the method. In your case: int Math.abs(int someNumber); tells you that Math.abs() takes an integer number and returns another integer n …
3 votes
4 answers
7k views
Shallow or deep equal, which one is idiomatic in Java?
I use Java for the implementation and I represent such an aggregation as a field of type List<B> in A, and a field of type A in B. In this way, each object can be the root of an aggregation tree. … So, is one of the two possibilities (shallow versus deep equality) considered a more idiomatic choice for implementing the equals method in Java? …
8 votes
2 answers
6k views
Why does Java use :: for method references instead of .?
I often wonder why Java uses :: for method references instead of ., e.g. why write System.out::println instead of System.out.println Of course, one might simply answer: "because the designers … On the other hand, I would have expected the second syntax because the dot is the usual Java syntax for accessing class members. …
5 votes
When to use functional programming approach and when not? (in Java)
Java was not designed for functional programming and so, while you can use a functional programming style in Java (immutable state, recursion, function composition, high-order functions, ...), you will … Therefore, even though a functional style in Java can make your code (sometimes) more readable or (more often) more robust, if you really want to use it heavily you'd better use a language that was designed …
6 votes
1 answer
1k views
Can Scala be considered a functional superset of Java?
Or are there any major features in Java for which there is no direct Scala equivalent? … Or can I expect that, given a Java program, I can port it to Scala almost line-by-line? …
2 votes
Accepted
How to solve cyclic dependencies in a visitor pattern
What about changing the visitor interface to remove the dependency from a to b? package pkg.a; public abstract ClassA extends ClassA { public abstract void accept(ClassAVisitor visitor); …
5 votes
Is there any practical way for a linked node structure to be immutable?
As others have pointed out, you are correct that an immutable singly-linked list requires copying the entire list when performing an append operations. Often you can use the workaround of implementin …
11 votes
2 answers
2k views
How will the new development of Java influence its interoperability with languages like Scal...
Starting with Java 8 (and maybe even more strongly with subsequent versions of Java), there will be changes in the semantics of the Java language. … Summarizing: can we expect that the future development of Java will have an impact on languages like Scala and Clojure to maintain interoperability with Java? …
40 votes
4 answers
27k views
Performance of Scala compared to Java
in Java? … I wrote a Java implementation (Java 6) and a Scala implementation (Scala 2.9). I have run both on Eclipse Indigo under Ubuntu 10.04. …