SHOW:
|
|
- or go back to the newest paste.
1 | package ch.claude_martin; | |
2 | ||
3 | import java.util.Arrays; | |
4 | - | import java.util.Optional; |
4 | + | import java.util.OptionalInt; |
5 | - | import java.util.stream.Stream; |
5 | + | |
6 | public class SomeClass { | |
7 | ||
8 | - | static class Tuple implements Comparable<Tuple> { |
8 | + | |
9 | - | final int max; |
9 | + | |
10 | - | final int[] vector; |
10 | + | |
11 | final int[] v3 = {}; | |
12 | - | public Tuple(int[] vector) { |
12 | + | |
13 | - | assert vector.length > 0; |
13 | + | long max = Long.MIN_VALUE; |
14 | - | this.max = Arrays.stream(vector).max().getAsInt(); |
14 | + | int[] maxVec = null; |
15 | - | this.vector = vector; |
15 | + | for (???????????) { |
16 | final OptionalInt m = Arrays.stream(v).max(); | |
17 | if (???????????) { | |
18 | - | @Override |
18 | + | max = m.getAsInt(); |
19 | - | public int compareTo(Tuple o) { |
19 | + | maxVec = v; |
20 | - | return Integer.compare(o.max, this.max); |
20 | + | } |
21 | } | |
22 | ||
23 | - | public int getMax() { |
23 | + | if (?????) |
24 | - | return max; |
24 | + | System.out.println(max + " -> " + Arrays.toString(maxVec)); |
25 | else | |
26 | System.out.println("No data"); | |
27 | - | public int[] getVector() { |
27 | + | |
28 | - | return vector; |
28 | + |