Skip to content

Commit 8799acb

Browse files
committed
Changed Bundlinbg by Multiple Fields examples to Java 8 support
1 parent 5748b0c commit 8799acb

File tree

2 files changed

+66
-25
lines changed

2 files changed

+66
-25
lines changed

pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<modelVersion>4.0.0</modelVersion>
55
<groupId>io.github.route4me</groupId>
66
<artifactId>route4me-java-sdk</artifactId>
7-
<version>1.11.2</version>
7+
<version>1.11.3</version>
88
<packaging>jar</packaging>
99
<properties>
1010
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

src/main/java/com/route4me/sdk/examples/bundling/BundlingUsingMultipleFields.java

+65-24
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@
3636
import java.util.ArrayList;
3737
import java.util.Arrays;
3838
import java.util.List;
39-
import java.util.Map;
39+
import java.util.stream.Collectors;
40+
import java.util.stream.Stream;
4041

4142
/**
4243
*
@@ -70,67 +71,107 @@ public static void main(String[] args) {
7071
Address address;
7172

7273
address = new Address("4738 BELLEVUE AVE, Louisville, KY, 40215", 38.179806, -85.775558, 300);
73-
address.setCustom_fields(Map.of("BUNDLING_KEY", "ZONE001", "LOCATION_ID", "FLOOR001"));
74+
address.setCustom_fields(Stream.of(new String[][]{
75+
{"BUNDLING_KEY", "ZONE001"},
76+
{"LOCATION_ID", "FLOOR001"},}).collect(Collectors.toMap(data -> data[0], data -> data[1])));
7477
addresses.add(address);
7578
address = new Address("4738 BELLEVUE AVE, Louisville, KY, 40215", 38.179806, -85.775558, 300);
76-
address.setCustom_fields(Map.of("BUNDLING_KEY", "ZONE001", "LOCATION_ID", "FLOOR001"));
79+
address.setCustom_fields(Stream.of(new String[][]{
80+
{"BUNDLING_KEY", "ZONE001"},
81+
{"LOCATION_ID", "FLOOR001"},}).collect(Collectors.toMap(data -> data[0], data -> data[1])));
7782
addresses.add(address);
7883
address = new Address("4738 BELLEVUE AVE, Louisville, KY, 40215", 38.179806, -85.775558, 300);
79-
address.setCustom_fields(Map.of("BUNDLING_KEY", "ZONE001", "LOCATION_ID", "FLOOR001"));
84+
address.setCustom_fields(Stream.of(new String[][]{
85+
{"BUNDLING_KEY", "ZONE001"},
86+
{"LOCATION_ID", "FLOOR001"},}).collect(Collectors.toMap(data -> data[0], data -> data[1])));
8087
addresses.add(address);
8188
address = new Address("4738 BELLEVUE AVE, Louisville, KY, 40215", 38.179806, -85.775558, 300);
82-
address.setCustom_fields(Map.of("BUNDLING_KEY", "ZONE001", "LOCATION_ID", "FLOOR003"));
89+
address.setCustom_fields(Stream.of(new String[][]{
90+
{"BUNDLING_KEY", "ZONE001"},
91+
{"LOCATION_ID", "FLOOR003"},}).collect(Collectors.toMap(data -> data[0], data -> data[1])));
8392
addresses.add(address);
8493
address = new Address("4738 BELLEVUE AVE, Louisville, KY, 40215", 38.179806, -85.775558, 300);
85-
address.setCustom_fields(Map.of("BUNDLING_KEY", "ZONE001", "LOCATION_ID", "FLOOR003"));
94+
address.setCustom_fields(Stream.of(new String[][]{
95+
{"BUNDLING_KEY", "ZONE001"},
96+
{"LOCATION_ID", "FLOOR003"},}).collect(Collectors.toMap(data -> data[0], data -> data[1])));
8697
addresses.add(address);
8798
address = new Address("4738 BELLEVUE AVE, Louisville, KY, 40215", 38.179806, -85.775558, 300);
88-
address.setCustom_fields(Map.of("BUNDLING_KEY", "ZONE001", "LOCATION_ID", "FLOOR003"));
99+
address.setCustom_fields(Stream.of(new String[][]{
100+
{"BUNDLING_KEY", "ZONE001"},
101+
{"LOCATION_ID", "FLOOR003"},}).collect(Collectors.toMap(data -> data[0], data -> data[1])));
89102
addresses.add(address);
90-
103+
address.setCustom_fields(Stream.of(new String[][]{
104+
{"BUNDLING_KEY", "FLOOR001"},
105+
{"LOCATION_ID", "Doe"},}).collect(Collectors.toMap(data -> data[0], data -> data[1])));
91106
address = new Address("318 SO. 39TH STREET, Louisville, KY, 40212", 38.259335, -85.815094, 300);
92-
address.setCustom_fields(Map.of("BUNDLING_KEY", "ZONE002", "LOCATION_ID", "FLOOR001"));
107+
address.setCustom_fields(Stream.of(new String[][]{
108+
{"BUNDLING_KEY", "ZONE002"},
109+
{"LOCATION_ID", "FLOOR001"},}).collect(Collectors.toMap(data -> data[0], data -> data[1])));
93110
addresses.add(address);
94111
address = new Address("318 SO. 39TH STREET, Louisville, KY, 40212", 38.259335, -85.815094, 300);
95-
address.setCustom_fields(Map.of("BUNDLING_KEY", "ZONE002", "LOCATION_ID", "FLOOR001"));
112+
address.setCustom_fields(Stream.of(new String[][]{
113+
{"BUNDLING_KEY", "ZONE002"},
114+
{"LOCATION_ID", "FLOOR001"},}).collect(Collectors.toMap(data -> data[0], data -> data[1])));
96115
addresses.add(address);
97116
address = new Address("318 SO. 39TH STREET, Louisville, KY, 40212", 38.259335, -85.815094, 300);
98-
address.setCustom_fields(Map.of("BUNDLING_KEY", "ZONE002", "LOCATION_ID", "FLOOR004"));
117+
address.setCustom_fields(Stream.of(new String[][]{
118+
{"BUNDLING_KEY", "ZONE002"},
119+
{"LOCATION_ID", "FLOOR004"},}).collect(Collectors.toMap(data -> data[0], data -> data[1])));
99120
addresses.add(address);
100121
address = new Address("318 SO. 39TH STREET, Louisville, KY, 40212", 38.259335, -85.815094, 300);
101-
address.setCustom_fields(Map.of("BUNDLING_KEY", "ZONE002", "LOCATION_ID", "FLOOR004"));
122+
address.setCustom_fields(Stream.of(new String[][]{
123+
{"BUNDLING_KEY", "ZONE002"},
124+
{"LOCATION_ID", "FLOOR004"},}).collect(Collectors.toMap(data -> data[0], data -> data[1])));
102125
addresses.add(address);
103-
104126
address = new Address("1324 BLUEGRASS AVE, Louisville, KY, 40215", 38.179253, -85.785118, 300);
105-
address.setCustom_fields(Map.of("BUNDLING_KEY", "ZONE003", "LOCATION_ID", "FLOOR001"));
127+
address.setCustom_fields(Stream.of(new String[][]{
128+
{"BUNDLING_KEY", "ZONE003"},
129+
{"LOCATION_ID", "FLOOR001"},}).collect(Collectors.toMap(data -> data[0], data -> data[1])));
106130
addresses.add(address);
107131
address = new Address("1324 BLUEGRASS AVE, Louisville, KY, 40215", 38.179253, -85.785118, 300);
108-
address.setCustom_fields(Map.of("BUNDLING_KEY", "ZONE003", "LOCATION_ID", "FLOOR001"));
132+
address.setCustom_fields(Stream.of(new String[][]{
133+
{"BUNDLING_KEY", "ZONE003"},
134+
{"LOCATION_ID", "FLOOR001"},}).collect(Collectors.toMap(data -> data[0], data -> data[1])));
109135
addresses.add(address);
110136
address = new Address("1324 BLUEGRASS AVE, Louisville, KY, 40215", 38.179253, -85.785118, 300);
111-
address.setCustom_fields(Map.of("BUNDLING_KEY", "ZONE003", "LOCATION_ID", "FLOOR002"));
137+
address.setCustom_fields(Stream.of(new String[][]{
138+
{"BUNDLING_KEY", "ZONE003"},
139+
{"LOCATION_ID", "FLOOR002"},}).collect(Collectors.toMap(data -> data[0], data -> data[1])));
112140
addresses.add(address);
113141
address = new Address("1324 BLUEGRASS AVE, Louisville, KY, 40215", 38.179253, -85.785118, 300);
114-
address.setCustom_fields(Map.of("BUNDLING_KEY", "ZONE003", "LOCATION_ID", "FLOOR002"));
142+
address.setCustom_fields(Stream.of(new String[][]{
143+
{"BUNDLING_KEY", "ZONE003"},
144+
{"LOCATION_ID", "FLOOR002"},}).collect(Collectors.toMap(data -> data[0], data -> data[1])));
115145
addresses.add(address);
116146
address = new Address("1324 BLUEGRASS AVE, Louisville, KY, 40215", 38.179253, -85.785118, 300);
117-
address.setCustom_fields(Map.of("BUNDLING_KEY", "ZONE003", "LOCATION_ID", "FLOOR003"));
147+
address.setCustom_fields(Stream.of(new String[][]{
148+
{"BUNDLING_KEY", "ZONE003"},
149+
{"LOCATION_ID", "FLOOR003"},}).collect(Collectors.toMap(data -> data[0], data -> data[1])));
118150
addresses.add(address);
119151
address = new Address("1324 BLUEGRASS AVE, Louisville, KY, 40215", 38.179253, -85.785118, 300);
120-
address.setCustom_fields(Map.of("BUNDLING_KEY", "ZONE003", "LOCATION_ID", "FLOOR003"));
152+
address.setCustom_fields(Stream.of(new String[][]{
153+
{"BUNDLING_KEY", "ZONE003"},
154+
{"LOCATION_ID", "FLOOR003"},}).collect(Collectors.toMap(data -> data[0], data -> data[1])));
121155
addresses.add(address);
122-
123156
address = new Address("4805 BELLEVUE AVE, Louisville, KY, 40215", 38.162472, -85.792854, 300);
124-
address.setCustom_fields(Map.of("BUNDLING_KEY", "ZONE004", "LOCATION_ID", "FLOOR001"));
157+
address.setCustom_fields(Stream.of(new String[][]{
158+
{"BUNDLING_KEY", "ZONE004"},
159+
{"LOCATION_ID", "FLOOR001"},}).collect(Collectors.toMap(data -> data[0], data -> data[1])));
125160
addresses.add(address);
126161
address = new Address("4805 BELLEVUE AVE, Louisville, KY, 40215", 38.162472, -85.792854, 300);
127-
address.setCustom_fields(Map.of("BUNDLING_KEY", "ZONE004", "LOCATION_ID", "FLOOR001"));
162+
address.setCustom_fields(Stream.of(new String[][]{
163+
{"BUNDLING_KEY", "ZONE004"},
164+
{"LOCATION_ID", "FLOOR001"},}).collect(Collectors.toMap(data -> data[0], data -> data[1])));
128165
addresses.add(address);
129166
address = new Address("4805 BELLEVUE AVE, Louisville, KY, 40215", 38.162472, -85.792854, 300);
130-
address.setCustom_fields(Map.of("BUNDLING_KEY", "ZONE004", "LOCATION_ID", "FLOOR002"));
167+
address.setCustom_fields(Stream.of(new String[][]{
168+
{"BUNDLING_KEY", "ZONE004"},
169+
{"LOCATION_ID", "FLOOR002"},}).collect(Collectors.toMap(data -> data[0], data -> data[1])));
131170
addresses.add(address);
132171
address = new Address("4805 BELLEVUE AVE, Louisville, KY, 40215", 38.162472, -85.792854, 300);
133-
address.setCustom_fields(Map.of("BUNDLING_KEY", "ZONE004", "LOCATION_ID", "FLOOR002"));
172+
address.setCustom_fields(Stream.of(new String[][]{
173+
{"BUNDLING_KEY", "ZONE004"},
174+
{"LOCATION_ID", "FLOOR002"},}).collect(Collectors.toMap(data -> data[0], data -> data[1])));
134175
addresses.add(address);
135176

136177
optParameters.setAddresses(addresses);

0 commit comments

Comments
 (0)