Migrate to sequenced collection

This commit is contained in:
Anton Tananaev
2026-05-16 15:49:15 -07:00
parent 4b9c974cdd
commit 054c151fc4
6 changed files with 9 additions and 9 deletions

View File

@@ -47,7 +47,7 @@ public class GoogleGeocoder extends JsonGeocoder {
if (!results.isEmpty()) {
Address address = new Address();
JsonObject result = (JsonObject) results.get(0);
JsonObject result = (JsonObject) results.getFirst();
JsonArray components = result.getJsonArray("address_components");
if (result.containsKey("formatted_address")) {

View File

@@ -37,7 +37,7 @@ public class MapboxGeocoder extends JsonGeocoder {
if (!features.isEmpty()) {
Address address = new Address();
JsonObject mostSpecificFeature = (JsonObject) features.get(0);
JsonObject mostSpecificFeature = (JsonObject) features.getFirst();
if (mostSpecificFeature.containsKey("place_name")) {
address.setFormattedAddress(mostSpecificFeature.getString("place_name"));

View File

@@ -32,7 +32,7 @@ public class MapmyIndiaGeocoder extends JsonGeocoder {
if (!results.isEmpty()) {
Address address = new Address();
JsonObject result = (JsonObject) results.get(0);
JsonObject result = (JsonObject) results.getFirst();
if (result.containsKey("formatted_address")) {
address.setFormattedAddress(result.getString("formatted_address"));

View File

@@ -208,7 +208,7 @@ public class RuptelaProtocolDecoder extends BaseProtocolDecoder {
if (positions.size() == 0) {
getLastLocation(position, null);
} else {
position = positions.remove(positions.size() - 1);
position = positions.removeLast();
}
}
}

View File

@@ -308,9 +308,9 @@ public class ReportUtils {
double maxSpeed = 0;
var positions = PositionUtil.getPositions(storage, device.getId(), from, to);
if (!positions.isEmpty()) {
boolean initialValue = positions.get(0).getBoolean(Position.KEY_MOTION);
boolean initialValue = positions.getFirst().getBoolean(Position.KEY_MOTION);
if (initialValue == trips) {
startPosition = positions.get(0);
startPosition = positions.getFirst();
maxSpeed = startPosition.getSpeed();
}
@@ -322,7 +322,7 @@ public class ReportUtils {
NewMotionState motionState = new NewMotionState();
motionState.setPositions(motionPositions);
motionState.setMotionStreak(initialValue);
motionState.setEventPosition(positions.get(0));
motionState.setEventPosition(positions.getFirst());
for (Position position : positions) {
maxSpeed = Math.max(maxSpeed, position.getSpeed());
@@ -385,7 +385,7 @@ public class ReportUtils {
}
if (startPosition != null) {
Position endPosition = positions.get(positions.size() - 1);
Position endPosition = positions.getLast();
result.add(calculateTripOrStop(
device, startPosition, endPosition, maxSpeed, ignoreOdometer, reportClass));
}

View File

@@ -116,7 +116,7 @@ public class DatabaseStorage extends Storage {
@Override
public <T> List<Long> addObjects(List<T> entities, Request request) throws StorageException {
Class<?> entityClass = entities.get(0).getClass();
Class<?> entityClass = entities.getFirst().getClass();
List<String> columns = request.getColumns().getColumns(entityClass, "get");
try (QueryBuilder builder = QueryBuilder.create(
config, dataSource, objectMapper, formatInsert(entityClass, columns), true)) {