Use enhanced for
This commit is contained in:
parent
1a1a696c53
commit
9d7264891c
@ -77,9 +77,9 @@ public class GenSerializerArrayX extends ClassGenerator {
|
||||
method.addStatement("final int sz = data.size()");
|
||||
method.addStatement("out.writeInt(sz)");
|
||||
method.addCode("\n");
|
||||
method.beginControlFlow("for (int i = 0; i < sz; ++i)");
|
||||
method.beginControlFlow("for (var item : data)");
|
||||
var baseSerializerInstance = typeArray.getBase().getJSerializerInstance(basePackageName);
|
||||
method.addStatement("$T.$N.serialize(out, ($T) data.get(i))",
|
||||
method.addStatement("$T.$N.serialize(out, ($T) item)",
|
||||
baseSerializerInstance.className(),
|
||||
baseSerializerInstance.fieldName(),
|
||||
typeArray.getBase().getJTypeName(basePackageName)
|
||||
|
@ -12,8 +12,8 @@ public class ArrayInt52Serializer implements DataSerializer< List<Int52>> {
|
||||
@Override
|
||||
public void serialize(DataOutput dataOutput, List<Int52> data) throws IOException {
|
||||
dataOutput.writeInt(data.size());
|
||||
for (Int52 datum : data) {
|
||||
Int52Serializer.INSTANCE.serialize(dataOutput, datum);
|
||||
for (Int52 item : data) {
|
||||
Int52Serializer.INSTANCE.serialize(dataOutput, item);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -12,8 +12,8 @@ public class ArrayStringSerializer implements DataSerializer<List<String>> {
|
||||
@Override
|
||||
public void serialize(DataOutput dataOutput, @NotNull List<String> data) throws IOException {
|
||||
dataOutput.writeInt(data.size());
|
||||
for (int i = 0; i < data.size(); i++) {
|
||||
dataOutput.writeUTF(data.get(i));
|
||||
for (String item : data) {
|
||||
dataOutput.writeUTF(item);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user