mirror of
https://github.com/traccar/traccar.git
synced 2026-05-24 17:00:44 -04:00
Migrate to sequenced collection
This commit is contained in:
@@ -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")) {
|
||||
|
||||
@@ -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"));
|
||||
|
||||
@@ -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"));
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
Reference in New Issue
Block a user