Я пытаюсь отфильтровать свой список массивов, создав отдельную переменную, в которой хранятся 3 верхних значения. Однако получаю ошибку в коллекциях. Я новичок в этом, поэтому любая помощь будет здорово!
public static ArrayList<exercise> exerciseDetail() {
ArrayList<exercise> elist = new ArrayList<>();
elist.add(new exercise("Bicycle Crunches", R.drawable.ic_launcher_background, "MEDIUM", "20 Reps or 1 Minute", "Beginner", "Bicycle crunches are a great way to target the rectus abdominis and the obliques in one easy exercise"));
elist.add(new exercise("Leg Raises", R.drawable.ic_launcher_background, "MEDIUM", "20 Reps or 1 Minute", "Beginner", "Bicycle crunches are a great way to target the rectus abdominis and the obliques in one easy exercise"));
elist.add(new exercise("Bridges", R.drawable.ic_launcher_background, "MEDIUM", "20 Reps or 1 Minute", "Beginner", "Bicycle crunches are a great way to target the rectus abdominis and the obliques in one easy exercise"));
elist.add(new exercise("Burpees", R.drawable.ic_launcher_background, "MEDIUM", "20 Reps or 1 Minute", "Beginner", "Bicycle crunches are a great way to target the rectus abdominis and the obliques in one easy exercise"));
elist.add(new exercise("Side Twists", R.drawable.ic_launcher_background, "MEDIUM", "20 Reps or 1 Minute", "Beginner", "Bicycle crunches are a great way to target the rectus abdominis and the obliques in one easy exercise"));
elist.add(new exercise("Planks", R.drawable.ic_launcher_background, "MEDIUM", "20 Reps or 1 Minute", "Beginner", "Bicycle crunches are a great way to target the rectus abdominis and the obliques in one easy exercise"));
elist.add(new exercise("Bicycle Crunches", R.drawable.ic_launcher_background, "MEDIUM", "20 Reps or 1 Minute", "Beginner", "Bicycle crunches are a great way to target the rectus abdominis and the obliques in one easy exercise"));
elist.add(new exercise("Bicycle Crunches", R.drawable.ic_launcher_background, "MEDIUM", "20 Reps or 1 Minute", "Beginner", "Bicycle crunches are a great way to target the rectus abdominis and the obliques in one easy exercise"));
elist.add(new exercise("Bicycle Crunches", R.drawable.ic_launcher_background, "MEDIUM", "20 Reps or 1 Minute", "Beginner", "Bicycle crunches are a great way to target the rectus abdominis and the obliques in one easy exercise"));
elist.add(new exercise("Bicycle Crunches", R.drawable.ic_launcher_background, "MEDIUM", "20 Reps or 1 Minute", "Beginner", "Bicycle crunches are a great way to target the rectus abdominis and the obliques in one easy exercise"));
elist.add(new exercise("Bicycle Crunches", R.drawable.ic_launcher_background, "MEDIUM", "20 Reps or 1 Minute", "Beginner", "Bicycle crunches are a great way to target the rectus abdominis and the obliques in one easy exercise"));
elist.add(new exercise("Bicycle Crunches", R.drawable.ic_launcher_background, "MEDIUM", "20 Reps or 1 Minute", "Beginner", "Bicycle crunches are a great way to target the rectus abdominis and the obliques in one easy exercise"));
elist.add(new exercise("Bicycle Crunches", R.drawable.ic_launcher_background, "MEDIUM", "20 Reps or 1 Minute", "Beginner", "Bicycle crunches are a great way to target the rectus abdominis and the obliques in one easy exercise"));
elist.add(new exercise("Bicycle Crunches", R.drawable.ic_launcher_background, "MEDIUM", "20 Reps or 1 Minute", "Beginner", "Bicycle crunches are a great way to target the rectus abdominis and the obliques in one easy exercise"));
elist.add(new exercise("Bicycle Crunches", R.drawable.ic_launcher_background, "MEDIUM", "20 Reps or 1 Minute", "Beginner", "Bicycle crunches are a great way to target the rectus abdominis and the obliques in one easy exercise"));
elist.add(new exercise("Bicycle Crunches", R.drawable.ic_launcher_background, "MEDIUM", "20 Reps or 1 Minute", "Beginner", "Bicycle crunches are a great way to target the rectus abdominis and the obliques in one easy exercise"));
elist.add(new exercise("Bicycle Crunches", R.drawable.ic_launcher_background, "MEDIUM", "20 Reps or 1 Minute", "Beginner", "Bicycle crunches are a great way to target the rectus abdominis and the obliques in one easy exercise"));
elist.add(new exercise("Bicycle Crunches", R.drawable.ic_launcher_background, "MEDIUM", "20 Reps or 1 Minute", "Beginner", "Bicycle crunches are a great way to target the rectus abdominis and the obliques in one easy exercise"));
elist.add(new exercise("Bicycle Crunches", R.drawable.ic_launcher_background, "MEDIUM", "20 Reps or 1 Minute", "Beginner", "Bicycle crunches are a great way to target the rectus abdominis and the obliques in one easy exercise"));
return elist;
ArrayList<exercise> filteredExercises = elist.stream().filter(item-> item.getName().equals("Bicycle Crunches") || item.getName().equals("Leg Raises")|| item.getName().equals("Bridges")).collect(Collectors.toList());
}
}