0
我有兩個列表:如何將兩個列表與舊訂單合併?
private static final List<String> NUMERIC_VALUES = Arrays.asList("100","5","1","0","1111111","6","11","12","50","99","101");
private static final List<String> ALPHANUMERIC_VALUES = Arrays.asList("10A0", "1B1", "6A", "A0", "A1", "ABC", "C5", "T-1", "TT", "TTT",
"434/32145", "434/12354", "32654B", "32654A", "32654B/1");
合併後,我將有:
[100, 5, 1, 0, 1111111, 6, 11, 12, 50, 99, 101, 10A0, 1B1, 6A, A0, A1, ABC, C5, T-1, TT, TTT, 434/32145, 434/12354, 32654B, 32654A, 32654B/1]
我想:
List<String> result = Stream.concat(NUMERIC_VALUES.stream(), ALPHANUMERIC_VALUES.stream()).collect(Collectors.toList());
而且也:
List<String> result = new ArrayList<String>();
result.addAll(NUMERIC_VALUES);
result.addAll(ALPHANUMERIC_VALUES);
但總是我'ge擬合
[100, 5, 1, 0, 1111111, 6, 11, 12, 50, 99, 101, 10A0, 1B1, 32654A, 32654B, 32654B/1, 434/12354, 434/32145, 6A, A0, A1, ABC, C5, T-1, TT, TTT]
似乎有什麼不對,你發佈的代碼。可能還有一些其他問題正在進行。 – Sedrick