我有两个Arraylist。
ArrayList<Thumbnail> videoList = new ArrayList<>();
List<Giphy> giphyList = new ArrayList<>();
如何比较两个Arraylist并更新List<Giphy>
中的ArrayList<Thumbnail>
数据或另一个第三Arraylist或覆盖ArrayList<Thumbnail>
中的List数据?
这里有两个类的缩略图和Giphy。 Giphy类与Thumbnail比较。存储在Arraylist中的Giphy Class数据和ArrayList中的ArrayUpdate或ArrayList中的数据被覆盖。
class Thumbnail{
private String gif,videoUrl;
private int id, thumbUp, thumbDown;
public Thumbnail (int id,String gif,String videoUrl,int thumbUp,int thumbDown){
this.gif = gif;
this.videoUrl = videoUrl;
}
public String getGif() {
return gif;
}
public void setGif(String gif) {
this.gif = gif;
}
public String getVideoUrl() {
return videoUrl;
}
public void setVideoUrl(String videoUrl) {
this.videoUrl = videoUrl;
}
public int getId() {
return id;
}
public int getThumbUp() {
return thumbUp;
}
public int getThumbDown() {
return thumbDown;
}
public void setId(int id) {
this.id = id;
}
public void setThumbUp(int thumbUp) {
this.thumbUp = thumbUp;
}
public void setThumbDown(int thumbDown) {
this.thumbDown = thumbDown;
}
}
}
@Entity
Class Giphy{
@Id
private long id;
private String url;
private int thumbUp;
private int thumbDown;
public Giphy(){
}
public Giphy(long id,String url,int thumbUp,int thumbDown){
this.id = id;
this.url = url;
this.thumbUp = thumbUp;
this.thumbDown = thumbDown;
}
public long getId() {
return id;
}
public String getUrl() {
return url;
}
public int getThumbUp() {
return thumbUp;
}
public int getThumbDown() {
return thumbDown;
}
public void setId(long id) {
this.id = id;
}
public void setUrl(String url) {
this.url = url;
}
public void setThumbUp(int thumbUp) {
this.thumbUp = thumbUp;
}
public void setThumbDown(int thumbDown) {
this.thumbDown = thumbDown;
}
}