Switch to use the isPresent() API since the isEmpty() is only available since java 11: https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/Optional.html#isEmpty().

PiperOrigin-RevId: 520099308
This commit is contained in:
Jiuqiang Tang 2023-03-28 12:18:09 -07:00 committed by Copybara-Service
parent 5c295da6ff
commit bda2639376

View File

@ -57,7 +57,7 @@ public abstract class FaceLandmarkerResult implements TaskResult {
} }
} }
Optional<List<List<Category>>> multiFaceBlendshapes = Optional.empty(); Optional<List<List<Category>>> multiFaceBlendshapes = Optional.empty();
if (!multiFaceBendshapesProto.isEmpty()) { if (multiFaceBendshapesProto.isPresent()) {
List<List<Category>> blendshapes = new ArrayList<>(); List<List<Category>> blendshapes = new ArrayList<>();
for (ClassificationList faceBendshapeProto : multiFaceBendshapesProto.get()) { for (ClassificationList faceBendshapeProto : multiFaceBendshapesProto.get()) {
List<Category> blendshape = new ArrayList<>(); List<Category> blendshape = new ArrayList<>();
@ -74,7 +74,7 @@ public abstract class FaceLandmarkerResult implements TaskResult {
multiFaceBlendshapes = Optional.of(Collections.unmodifiableList(blendshapes)); multiFaceBlendshapes = Optional.of(Collections.unmodifiableList(blendshapes));
} }
Optional<List<float[]>> multiFaceTransformationMatrixes = Optional.empty(); Optional<List<float[]>> multiFaceTransformationMatrixes = Optional.empty();
if (!multiFaceTransformationMatrixesProto.isEmpty()) { if (multiFaceTransformationMatrixesProto.isPresent()) {
List<float[]> matrixes = new ArrayList<>(); List<float[]> matrixes = new ArrayList<>();
for (MatrixData matrixProto : multiFaceTransformationMatrixesProto.get()) { for (MatrixData matrixProto : multiFaceTransformationMatrixesProto.get()) {
if (matrixProto.getPackedDataCount() != 16) { if (matrixProto.getPackedDataCount() != 16) {