I cant seem to find my problem, I even used '.equals' instead of "==" and it still isn't working. PLEASE HELP. Where did I go wrong?
package com.codegym.task.task08.task0812;
import java.io.*;
import java.util.ArrayList;
/*
Longest sequence
*/
public class Solution {
public static void main(String[] args) throws IOException {
// input read from user
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
//array for user input values
ArrayList<Integer> list = new ArrayList<Integer>();
//counter for longest sequence number
int maxCounter = 0;
//each input is added to the ArrayList
for(int i = 0; i<=9; i++){
list.add(Integer.valueOf(br.readLine()));
}
//value of first item in array taken
Integer value = list.get(0);
//counter for counter number of values in a sequence
int count = 1;
//loop starts at 1 because 'value' contains the first item to be compared
for(int next = 1; next< list.size(); next++){
//if the value is equal to the next value , increase count
if(value.equals(list.get(next))){
count++;
}else{//else set value to the next number to consider and save the count as
// maxCounter if it was larger then previous maxCounter
if(count>maxCounter){
maxCounter = count;
}
value = list.get(next);// new value to start counting the sequence
count = 1;// count set back to 1
}
}
System.out.println(maxCounter);
}
}