小编PAu*_*jla的帖子

在Java中,检查列表是否包含另一个列表中的项目(两个列表具有相同类型)的最快方法是什么?

假设我有一个名为 MyClass 的类,如下所示:

public class MyClass
{
     //Identifier is alpha-numeric. If the identifier starts will 'ZZ'
     //is special special identifier.
     private String identifier = null;
     //Date string format YYYY-MM-DD
     private String dateString = null;
     //Just a flag (not important for this scenario)
     private boolean isCoolCat = false;
     //Default Constructor and getters/setters implemented
     //Overrides the standard Java equals() method.
     //This way, when ArrayList calls contains() for MyClass objects
     //it will only check the Date (for ZZ identifier) 
     //and identifier values against …
Run Code Online (Sandbox Code Playgroud)

java optimization list

5
推荐指数
1
解决办法
5608
查看次数

标签 统计

java ×1

list ×1

optimization ×1