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
Binary Tree max sum conditionally
If I understand the rules correctly, it can me implemented in O(N) in the following way:
Attach a second integer to each node
non-leaf node = 0, leaf node = node's main value.
Do a depth-first walk. …
1
vote
Scaling decimal numbers up within bounds of limit
double smallest = Double.MAX_VALUE;
This is even larger:
double smallest = Double.POSITIVE_INFINITY;
if (exp < smallest) {
smallest = exp;
}
Unless you need to do something el …
2
votes
0
answers
41
views
Wait until thread is stopped from within thread
This is an abbreviated version of a serial receiver that can be started and stopped like a resource. The idea is that a thread will listen to an InputStream and dispatch received data to registered li …
4
votes
Reverse a sentence in Java
This solution sacrifices both time and space, for a very readable solution. In practice it's bad to prematurely optimize and always good to maximize readability before starting to optimize.
static ch …
5
votes
2
answers
4k
views
Check for timeout in wait() loop
I want to check for a condition in a guarded wait() loop with a user-specified total timeout, similar to how LinkedBlockingQueue.poll() works.
For example collection can be appended to by different t …