Auto saved by Logseq

This commit is contained in:
Matthias Eckert 2023-08-14 08:52:22 +02:00
parent de14b0747e
commit c299225157
2 changed files with 15 additions and 13 deletions

View File

@ -1,14 +1,14 @@
- String key value to map [[Code Snippet]] [[Java]] - String key value to map [[Code Snippet]] [[Java]]
- ``` java - ``` java
private MultiValueMap<String, String> params(final String... params) { private MultiValueMap<String, String> params(final String... params) {
if (params.length % 2 != 0) { if (params.length % 2 != 0) {
throw new IllegalArgumentException("The params need to be as key value pair"); throw new IllegalArgumentException("The params need to be as key value pair");
} }
final LinkedMultiValueMap<String, String> result = new LinkedMultiValueMap<>(); final LinkedMultiValueMap<String, String> result = new LinkedMultiValueMap<>();
IntStream.range(0, params.length / 2) IntStream.range(0, params.length / 2)
.map(i -> i * 2) .map(i -> i * 2)
.mapToObj(i -> new ImmutablePair<>(params[i], params[i + 1])) .mapToObj(i -> new ImmutablePair<>(params[i], params[i + 1]))
.forEach(p -> result.add(p.getLeft(), p.getRight())); .forEach(p -> result.add(p.getLeft(), p.getRight()));
return result; return result;
} }
``` ```

View File

@ -21,5 +21,7 @@
- Wer braucht welche Software - Wer braucht welche Software
- Mobilgeräte - Mobilgeräte
- Wer soll welches Gerät haben - Wer soll welches Gerät haben
- Bechtle als Dienstleister, Inbetriebnahme immer im LAN von BDO Gebäude - Bechtle als Dienstleister
- neue Geräte - Inbetriebnahme immer im LAN von BDO Gebäude
- neue Geräte
- wer braucht wo sein Gerät