Skip to content

Commit cfe725e

Browse files
committed
Use List.get(0) instead of getFirst() for Java 17 compatibility
This module compiles against sourceCompatibility=17, but List.getFirst() was added in Java 21 (SequencedCollection), so it failed to resolve. Replaced both calls with List.get(0) and removed the now-unused local variable.
1 parent 502eb9c commit cfe725e

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

laboratory/src/org/labkey/laboratory/assay/AssayHelper.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,6 @@ public Map<String, Object> saveTemplate(User u, Container c, ExpProtocol protoco
144144
row.put("importMethod", importMethod);
145145
row.put("json", json.toString());
146146

147-
List<Map<String,Object>> saved;
148147
if (templateId == null)
149148
{
150149
BatchValidationException bve = new BatchValidationException();
@@ -154,13 +153,13 @@ public Map<String, Object> saveTemplate(User u, Container c, ExpProtocol protoco
154153
throw bve;
155154
}
156155

157-
return rows.getFirst();
156+
return rows.get(0);
158157
}
159158
else
160159
{
161160
row.put("rowid", templateId);
162161
List<Map<String, Object>> rows = ti.getUpdateService().updateRows(u, c, Arrays.asList(row), Arrays.asList(Map.of("rowId", templateId)), null, null);
163-
return rows.getFirst();
162+
return rows.get(0);
164163
}
165164
}
166165
catch (Exception e)

0 commit comments

Comments
 (0)