[ 
https://issues.apache.org/jira/browse/HADOOP-17099?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17157641#comment-17157641
 ] 

Ahmed Hussein commented on HADOOP-17099:
----------------------------------------

Thanks [~jeagles]! I believe that using {{stream.filter}} then {{findFirst}} 
would imply iterating on the entire collection. Perhaps, a {{for-loop}} that 
returns on the first element that satisfies the {{Predicate}} should do the job.

 

I checked the Unit tests:

 
|TestHDFSContractMultipartUploader|Broken on Trunk. HDFS-15471.|Broken|
|TestCapacityOverTimePolicy| |Flaky|
|TestDecommission| |Flaky|
|TestDecommissionWithStripedBackoffMonitor| |Flaky|
|TestDFSStripedOutputStreamWithRandomECPolicy| |Flaky|
|TestExternalStoragePolicySatisfier|filed HDFS-15456|Flaky|
|TestFileChecksum|for HADOOP-17101, filed HDFS-15461|Flaky|
|TestFixKerberosTicketOrder| |Flaky|
|TestHDFSFileSystemContract| |Flaky|
|TestMaintenanceState| |Flaky|
|TestQuota| |Flaky|
|TestRaceWhenRelogin| |Flaky|
|TestSafeModeWithStripedFile| |Flaky|
|TestBlockTokenWithDFSStriped|Filed Jira HDFS-15459|Flaky|
|TestDFSInotifyEventInputStreamKerberized| |Flaky|
|TestNameNodeRetryCacheMetrics|filed a jira HDFS-1548|Flaky|
|TestDFSUpgradeWithHA| |Flaky|

> Replace Guava Predicate with Java8+ Predicate
> ---------------------------------------------
>
>                 Key: HADOOP-17099
>                 URL: https://issues.apache.org/jira/browse/HADOOP-17099
>             Project: Hadoop Common
>          Issue Type: Sub-task
>            Reporter: Ahmed Hussein
>            Assignee: Ahmed Hussein
>            Priority: Minor
>         Attachments: HADOOP-17099.004.patch, HADOOP-17099.005.patch
>
>
> {{com.google.common.base.Predicate}} can be replaced with 
> {{java.util.function.Predicate}}. 
> The change involving 9 occurrences is straightforward:
> {code:java}
> Targets
>     Occurrences of 'com.google.common.base.Predicate' in project with mask 
> '*.java'
> Found Occurrences  (9 usages found)
>     org.apache.hadoop.hdfs.server.blockmanagement  (1 usage found)
>         CombinedHostFileManager.java  (1 usage found)
>             43 import com.google.common.base.Predicate;
>     org.apache.hadoop.hdfs.server.namenode  (1 usage found)
>         NameNodeResourceChecker.java  (1 usage found)
>             38 import com.google.common.base.Predicate;
>     org.apache.hadoop.hdfs.server.namenode.snapshot  (1 usage found)
>         Snapshot.java  (1 usage found)
>             41 import com.google.common.base.Predicate;
>     org.apache.hadoop.metrics2.impl  (2 usages found)
>         MetricsRecords.java  (1 usage found)
>             21 import com.google.common.base.Predicate;
>         TestMetricsSystemImpl.java  (1 usage found)
>             41 import com.google.common.base.Predicate;
>     org.apache.hadoop.yarn.logaggregation  (1 usage found)
>         AggregatedLogFormat.java  (1 usage found)
>             77 import com.google.common.base.Predicate;
>     org.apache.hadoop.yarn.logaggregation.filecontroller  (1 usage found)
>         LogAggregationFileController.java  (1 usage found)
>             22 import com.google.common.base.Predicate;
>     org.apache.hadoop.yarn.logaggregation.filecontroller.ifile  (1 usage 
> found)
>         LogAggregationIndexedFileController.java  (1 usage found)
>             22 import com.google.common.base.Predicate;
>     org.apache.hadoop.yarn.server.nodemanager.containermanager.logaggregation 
>  (1 usage found)
>         AppLogAggregatorImpl.java  (1 usage found)
>             75 import com.google.common.base.Predicate;
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to