« first day (3851 days earlier)      last day (1076 days later) » 

12:00 AM
"Any excuse will serve a tyrant." -- Aesop (source)
 
 
3 hours later…
3:14 AM
  public static int[][] product(int[][] sets, int index) {
    if(index >= sets.length){
      return new int[][]{new int[]{}};
    }

    return Stream.of(product(sets, index + 1))
                .map(x -> Stream.of(sets[index])
                    .map(y -> IntStream.concat(IntStream.of(y), IntStream.of(x)).toArray()).toArray(int[][]::new)).reduce((x,y)->Stream.concat(Stream.of(x), Stream.of(y)).toArray(int[][]::new)).orElse(new int[][]{new int[]{}});
  }

Why this code won't compute the cartesian product?
For input: int[][] sets = new int[][] { new int[] { 1, 2 }, new int[] { 3, 4, 5 }, };
I get: {{1, 2, 3, 4, 5}} which sounds like a joke.
 
 
2 hours later…
5:36 AM
hey... is anyone active here?
 
@Ojasvsingh Welcome to the Java Chat, the room for Java enthusiasts! I'm Oak, one of the room's bots. If you want to ask a question, just ask it and someone will respond if they feel like it. But remember that this room is not a help desk or tutoring service! If you want to just hang out, then welcome aboard! Oh, and the room's full list of rules are posted here.
 
I am getting GC overhead limit exceeded error in maven
Checked the code... it is working fine on other systems.
I am getting GC overhead limit exceeded error in maven
1. Checked the code... it is working fine on other systems.
2. Reinstalled maven and used the bundled maven that comes with intelliJ
3. added -Xmx4098m to .zshrc file
4. monitored the heap space using virtualVM and the current heap space is well below the max heap space.
Would appreciate any help
 
 
1 hour later…
7:09 AM
1
Q: Maven Java heap space and GC overhead limit exceeded

Ojasv singhI am trying to build jar of a maven project using mvn clean package and mvn clean install. I am getting GC overhead limit exceeded and Java heap space error [INFO] --- maven-bundle-plugin:5.1.2:bundle (default) @ <project_name> --- [INFO] ----------------------------------------------------------...

 
 
2 hours later…
Zoe
9:03 AM
/javadoc IntStream#concat
 
@Zoe was that related to my question?
 
Zoe
no
 
 
1 hour later…
10:11 AM
whats the best practice here, use id or not?
 
 
6 hours later…
4:13 PM
@XRFXLP I would recommend making a dedicated class for a matrix
as for the cartesian product, you would use
Stream.of(a)
    .flatMap(l -> Stream.of(b).map(r -> new Pair(l, r)))
which gives you a Stream<Pair<Integer>>
you might have to make a Pair class though
also, maybe map is called mapToObj
I havent fiddled a lot with the primitive streams
 
 
2 hours later…
Zoe
6:01 PM
2 messages moved to Trash can
 

« first day (3851 days earlier)      last day (1076 days later) »