Error of the difference of types of objects in the array?

Hello,tell me how to fix this problem with listitems variable arrays in Adapter class and HorizontalAdapter .
Error:(140, 55) error: incompatible types: List<string> cannot be converted to List<listitem></listitem></string>


public class Adapter extends RecyclerView.Adapter<adapter.memviewholder>{

 private List<string> listItems;
 private List<string> list;
 private Context Context;
 private List<string> uid;
 private ProgressBar progressBar;
 private RecyclerView recyclerView;
 private TextView tv_likes, tv_dislikes, txtProgress;
 private ImageView memImage;
 private ImageButton button_like, button_dislike;

 public Adapter(List<string> uids){
 this.uid = uid;
}

@Override
 public MemViewHolder onCreateViewHolder(ViewGroup parent, int viewType){
 return new MemViewHolder(LayoutInflater.from(parent.getContext())
 .inflate(R. layout.recycler_item, parent, false));
}

@Override
 public void onBindViewHolder(MemViewHolder holder, int position){
 FirebaseDatabase database;
 DatabaseReference reference;
 String uid = list.get(position);
 database = FirebaseDatabase.getInstance();

 reference = database.getReference("Memes").child(uid).child("url");
 Log.i("DANIIL", uid);
 reference.addListenerForSingleValueEvent(new ValueEventListener() {
@Override
 public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
 String url = dataSnapshot.getValue(String.class);
Glide.with(context).load(url).into(memImage);
}

@Override
 public void onCancelled(@NonNull DatabaseError databaseError) {

}
});

 reference = database.getReference("Memes").child(uid).child("tags");
 reference.addListenerForSingleValueEvent(new ValueEventListener() {
@Override
 public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
 String tags = dataSnapshot.getValue(String.class);
 char[] tags_c = tags.toCharArray();
 String tag;
 int i = 0;
 while (tags_c[i] != the '@'){
 tag = "";
 while (tags_c[i] != '%'){
 tag += tags_c[i];
i++;
}
listItems.add(tag);
i++;
}
}

@Override
 public void onCancelled(@NonNull DatabaseError databaseError) {

}
});

 reference = database.getReference("Memes").child(uid).child("rate");
 reference.addValueEventListener(new ValueEventListener() {
@Override
 public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
 String rate = dataSnapshot.getValue(String.class);
 char[] rate_c = rate.toCharArray();
 Likes_s String = "", dislikes_s = "";
 boolean flag = false;
 for (int i = 0; i < rate_c.length; i++){
 if (flag){
 dislikes_s += rate_c[i];
}else{
 if (rate_c[i] == '/'){
 flag = true;
 }else {
 likes_s += rate_c[i];
}
}
}
tv_dislikes.setText(dislikes_s);
tv_likes.setText(likes_s);
 Likes Float = Float.valueOf(likes_s);
 Dislikes Float = Float.valueOf(dislikes_s);

 Float ratingF = (likes / (likes + dislikes)) * 100;
 Integer rating = Math.round(ratingF);

 txtProgress.setText(rating.toString() + "%");
progressBar.setProgress(rating);
}

@Override
 public void onCancelled(@NonNull DatabaseError databaseError) {

}
});


recyclerView.setHasFixedSize(true);
 recyclerView.setLayoutManager(new LinearLayoutManager(context));
 listItems = new ArrayList<>();

 recyclerView.setLayoutManager(new LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL,false));
 recyclerView.setAdapter(new HorizontalAdapter(listItems, context));//error</string></string></string></string></adapter.memviewholder>


public class RecyclerView extends HorizontalAdapter
 .Adapter<horizontaladapter.horizontalviewholder> {
 private Context Context;
 List<listitem> listItems;

 public HorizontalAdapter(List<listitem> listItems, Context Context) {
 this.context = context;
 this.listItems = listItems;

}

@Override
 public HorizontalViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
 LayoutInflater inflater = LayoutInflater.from(parent.getContext());
 View View = inflater.inflate(R. layout.tag_card, parent, false);

 return new HorizontalAdapter.HorizontalViewHolder(view);
}

@Override
 public void onBindViewHolder(HorizontalAdapter.HorizontalViewHolder holder, int position) {
 ListItem listItem = listItems.get(position);
holder.tagText.setText(listItem.getTag());
 }</listitem></listitem></horizontaladapter.horizontalviewholder>


public class ListItem {
 private String tag;

 public ListItem(String tag){
 this.tag = tag;
}

 public String getTag(){
 return tag;
 }
June 3rd 19 at 21:03
1 answer
June 3rd 19 at 21:05
Like after all. You have in the first case, the collection holds strings, and the second ListItem. They have nothing to do with each other. Replace HorizontalAdapter
List<listitem> listItems;</listitem>
on
List<string> listItems;</string>
and the error will disappear this.
And indeed it is not clear why you need the class ListItem, if it's just a wrapper over the string without adding new functionality. Replace it everywhere in the String.

Find more questions by tags AndroidJava