Skip to content
Advertisement

Why am I getting “NoSuchElementException” When I can print everything from textfile?

I’m able to read everything from the text file and print the data yet I get a “No Such Element” Exception. All the solutions i’ve found say to use “HasNext” in while loop and yet it doesn’t seem to work for me public void fileReader() throws IOException { C001,Toyota,Yaris,Sedan,2012,4,Blue,50,15,10,10 C002,Toyota,Corolla,Hatch,2020,4,White,45,20,10,10 C003,Toyota,Kluger,SUV,2019,7,Grey,70,20,20,10 C004,Audi,A3,Sedan,2015,5,Red,65,10,20,10 C005,Holden,Cruze,Hatch,2020,4,Green,70,10,10,10 C006,BMW,X5,SUV,2018,7,White,100,25,20,10 C007,BMW,320i,Sedan,2021,5,Grey,75,10,15,N/A C008,Ford,Focus,Sedan,2014,5,Red,45,10,10,N/A C009,Ford,Puma,SUV,2015,5,Black,70,20,15,20 This is the

How to find the index of maximum element in ojalgo?

How to find the index of maximum element in ojalgo? To find maximum I can use double res = mat.aggregateAll(Aggregator.MAXIMUM);, but how to find the maximum’s indices? PS: the mat is type of SparseStore<Double> Answer You don’t specify what type mat is? There is a method indexOfLargest() defined in the Access1D.Aggregatable interface – implemented by a lot of different classes.

Advertisement