Stack Overflow Weekly Newsletter
Stack Overflow Weekly Newsletter

Top new questions this week:

Why is 0[0] syntactically valid?

Why is this line valid in javascript ? var a = 0[0]; After that, a is undefined.

asked by Michael 53 votes
answered by jfriend00 69 votes

Where do gradle unit tests for Google app engine expect persistence.xml?

I have created a Google app engine project using an maven archetype project with the Datanucleus JPA provider, essentially following the Google app engine documentation. Everything works fine when ...

java google-app-engine jpa junit gradle  
asked by itchee 40 votes
answered by skullkid 7 votes

Why does this Java 8 lambda fail to compile?

The following Java code fails to compile: @FunctionalInterface private interface BiConsumer<A, B> { void accept(A a, B b); } private static void takeBiConsumer(BiConsumer<String, ...

java lambda compiler-errors java-8 void  
asked by Brian Gordon 39 votes
answered by assylias 50 votes

Why does toString fail to produce the correct value on an immutable BigDecimal?

import java.math.BigDecimal; import java.math.RoundingMode; public class BigDecimalTest { public static void main (String[] args) { // 4.88...e+888 (1817 digits) BigDecimal x = new ...

java bigdecimal  
asked by MikeM 28 votes
answered by Marco13 17 votes

Is it more efficient to perform a range check by casting to uint instead of checking for negative values?

I stumbled upon this piece of code in .NET's List source code: // Following trick can reduce the range check by one if ((uint) index >= (uint)_size) { ...

c# performance micro-optimization numeric-conversion range-checking  
asked by enzi 26 votes
answered by Damien_The_Unbeliever 22 votes

ArrayList<Integer> takes String

public class Main { public static void main(String[] args) { ArrayList<Integer> ar = new ArrayList<Integer>(); List l = new ArrayList(); l.add("a"); ...

java arraylist collections  
asked by user2697032 26 votes
answered by Jon Skeet 46 votes

Why filter() after flatMap() is "not completely" lazy in Java streams?

I have the following sample code: System.out.println( "Result: " + Stream.of(1, 2, 3) .filter(i -> { System.out.println(i); ...

java lambda java-8 java-stream  
asked by Vadym S. Khondar 23 votes
answered by Holger 12 votes

Greatest hits from previous weeks:

Unsupported major.minor version 51.0

I am trying to use Notepad++ as my all-in-one tool edit, run, compile, etc. I have JRE installed, and I have setup my path variable to the .../bin directory. When I run my "Hello world" in ...

java jvm notepad++  
asked by ERJAN 582 votes
answered by Juha Palomäki 841 votes

Split a string in C++?

What's the most elegant way to split a string in C++? The string can be assumed to be composed of words separated by whitespace. (Note that I'm not interested in C string functions or that kind of ...

c++ split c++-faq stdstring  
asked by Ashwin 1257 votes
answered by Zunino 653 votes

Can you answer these?

How to define a proper data structure for a parameter set

I need a data structure for the following: In a device that has memory slots, each of the slots has a set of parameters. These parameters have different types. The list of possible parameters is ...

asked by Mathias Weyel 5 votes

How can I pass RTS options to runghc?

For ghci, I can limit the memory ghci can use by $ ghci +RTS -M10m -RTS When I compile the whole program, I can $ ghc -rtsopts a.hs then $ ./a +RTS -M10m How can I do this for runghc a.hs? ...

haskell ghc  
asked by Yosh 6 votes

Allowing correlation parameters in gls to depend on grouping factor

Below there's a MWE of the issue I'm encountering. I'm using the Orthodont dataset from the nlme package which consists of 4 measurements for 27 children (16 girls, 11 boys). To model the correlation ...

r nlme  
asked by johansteen 5 votes
Subscribe to more Stack Exchange newsletters

Unsubscribe from this newsletter or change your email preferences by visiting your subscriptions page on

Questions? Comments? Let us know on our feedback site. If you no longer want to receive mail from Stack Exchange, unsubscribe from all emails.

Stack Exchange, Inc. 110 William St, 28th Floor, NY NY 10038 <3