Q:

How should I get the difference between 2 list

there are 2 Entity list with different size and objects, for example List<BrandEntity> baseEntityList and List<BrandEntity> subEntityList, now I want to get the result which stored in baseEntityList and not in subEntityList, the different dimension is brandName. I have overwrite the equals method but it doesn't work. Here are my codes.
Main.class: 
  findDifferenceList(baseEntityList, subEntityList)
Method:

private <T> List<T> findDifferenceList(List<T> baseBrandList, List<T> subBrandList) {
return baseBrandList.stream().filter(item -> !subBrandList.contains(item)).collect(toList());

}
BrandEntity:

@Slf4j
public class BrandEntity {
  @JsonSetter("shopid")
  Long shopId;

  @JsonSetter("brand")
  String brandName;

  @JsonIgnore Long principalId;

  // getter and setter

  @Override
  public boolean equals(Object o) {
    if (this == o) return true;
    if (o == null || getClass() != o.getClass()) return false;
    BrandEntity that = (BrandEntity) o;
    return Objects.equals(brandName, that.brandName);
  }

  @Override
  public int hashCode() {
    return Objects.hash(brandName);
  }
}

A:

Well what you are doing is comparing the Strings based on their reference equality - as seen in Objects(below). But you need to compare them on their value equality like brandName.equals(that.brandName).
public static boolean equals(Object a, Object b) {
    return (a == b) || (a != null && a.equals(b));
}

Neverthenless I would rather use a existing libary to compare the List, like Apache's commons CollectionUtils:
CollectionUtils.removeAll(List<T> baseBrandList, List<T> subBrandList);

