I have an array that I want to check the last digits if it is in the array.
Example:
String[] types = {".png",".jpg",".gif"}
String image = "beauty.jpg";
Boolean true = image.endswith(types);
Note: I know that I can check every single element using a for loop.
I want to know if there is a more efficient way to do this. The reason is that the image row is already in a loop with constant change.
source
share