How to read all elements in the screen by scrolling till the end of the list

int counter =0;
boolean firsttime =true;
while(true){
AndroidElement transactionlist = driver.findElementById(“com.finwizard.fisdom:id/transactionlist”);
List transactiontext = transactionlist.findElementsByClassName(“android.widget.TextView”);
System.out.println(transactiontext.get(counter).getText());
if(transactiontext.get(counter).getText().equalsIgnoreCase(“ICICI prudential Long Term”)){
break;
}
if(counter ==5){
if(firsttime){
counter= 0;
Horizontal.horizontalswipe();
}
}
counter++;
}

i am reading 5 rows at a time then scrolling for next five rows