diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/FilterListBase.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/FilterListBase.java index d6bb75cd047..ad24d0e47d9 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/FilterListBase.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/FilterListBase.java @@ -21,7 +21,6 @@ package org.apache.hadoop.hbase.filter; import java.io.IOException; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; import org.apache.hadoop.hbase.Cell; @@ -49,7 +48,12 @@ public abstract class FilterListBase extends FilterBase { } protected static boolean isInReturnCodes(ReturnCode testRC, ReturnCode... returnCodes) { - return Arrays.stream(returnCodes).anyMatch(testRC::equals); + for (ReturnCode rc : returnCodes) { + if (testRC == rc) { + return true; + } + } + return false; } protected static boolean checkAndGetReversed(List rowFilters, boolean defaultValue) { @@ -57,9 +61,10 @@ public abstract class FilterListBase extends FilterBase { return defaultValue; } boolean retValue = rowFilters.get(0).isReversed(); - boolean allEqual = rowFilters.stream().allMatch(f -> f.isReversed() == retValue); - if (!allEqual) { - throw new IllegalArgumentException("Filters in the list must have the same reversed flag"); + for (int i = 1, n = rowFilters.size(); i < n; i++) { + if (rowFilters.get(i).isReversed() != retValue) { + throw new IllegalArgumentException("Filters in the list must have the same reversed flag"); + } } return retValue; } diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/FilterListWithOR.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/FilterListWithOR.java index ba4cd88c6c8..28540a4fa13 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/FilterListWithOR.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/FilterListWithOR.java @@ -21,7 +21,6 @@ package org.apache.hadoop.hbase.filter; import org.apache.hadoop.hbase.Cell; import org.apache.hadoop.hbase.CellUtil; -import org.apache.hadoop.hbase.KeyValueUtil; import org.apache.yetus.audience.InterfaceAudience; import java.io.IOException; @@ -254,7 +253,7 @@ public class FilterListWithOR extends FilterListBase { // need not save current cell to prevCellList for saving heap memory. prevCellList.set(index, null); } else { - prevCellList.set(index, KeyValueUtil.toNewKeyCell(currentCell)); + prevCellList.set(index, currentCell); } }