-
Notifications
You must be signed in to change notification settings - Fork 425
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make improvements to methods using toArray(). #886
Conversation
Isira-Seneviratne
commented
Aug 4, 2022
- I carefully read the contribution guidelines and agree to them.
- I have tested the API against NewPipe.
final String[] keySet = kioskList.keySet().toArray(new String[0]); | ||
return getExtractorById(keySet[0], nextPage, localization); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this can be improved, in order to avoid uselessly converting the list to an array (my code was not checked, improve it if there are warnings)
final String[] keySet = kioskList.keySet().toArray(new String[0]); | |
return getExtractorById(keySet[0], nextPage, localization); | |
final String kioskId = kioskList.keySet().stream().findAny().get(); | |
return getExtractorById(kioskId, nextPage, localization); |
@@ -124,9 +125,7 @@ public static String[] getLinksFromString(final String txt) throws ParsingExcept | |||
links.add(txt.substring(ls.getBeginIndex(), ls.getEndIndex())); | |||
} | |||
|
|||
String[] linksarray = new String[links.size()]; | |||
linksarray = links.toArray(linksarray); | |||
return linksarray; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this method is just unused... Should we remove it or keep it in case it becomes handy later? In the second case, just change the function signature and avoid converting links
to an array
0ff0054
to
82a5768
Compare
extractor/src/main/java/org/schabi/newpipe/extractor/kiosk/KioskList.java
Outdated
Show resolved
Hide resolved
82a5768
to
7daca10
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM