Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package br.estatisticas;
- import br.modelos.Solve;
- import java.util.ArrayList;
- import java.util.Collections;
- /**
- * Criado por Lucas Sousa em 21/10/2015.
- */
- public class Worst {
- private ArrayList<Solve> solves;
- public Worst(ArrayList<Solve> solves){
- this.solves = solves;
- }
- private int getIndexOfWorst(){
- if (solves != null){
- if (solves.size() >= 1){
- ArrayList<Long> longTimes = new ArrayList<>();
- for (Solve s : solves){
- longTimes.add(s.getTime());
- }
- return longTimes.indexOf(Collections.max(longTimes));
- }
- }
- return 0;
- }
- public long getWorstValue(){
- ArrayList<Long> longTimes = new ArrayList<>();
- for (Solve s : solves){
- longTimes.add(s.getTime());
- }
- return longTimes.get(getIndexOfWorst());
- }
- public String getWorstSolve(){
- return solves.get(getIndexOfWorst()).toString();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement