honestly I'm just really stuck right now on this problem and don't really know how to go about this. I need to write a method where I am given a LinkedList of Characters (for example: {'a', 'A', 'd', 'X'}) and return a list of just the uppercase Characters (return: {'A', 'X'}). How do I go about writing this program?
import org.w3c.dom.Node;
public class ListExample {
public final class Node<T> {
public final T value;
public Node<T> next;
public Node(T _value) {
this( _value, null );
}
public Node(T _value, Node<T> _next) {
value = _value;
next = _next;
}
@Override
public String toString() {
return "" + value;
}
}
public static Node<Character> getUppercaseList(Node<Character> head) {
Node<Character> tail = null;
Node<Character> result = null;
while(head != null) {
}
return null;
}
}
Thanks for any and all help!
Iterate through the list of characters, building up a list of uppercase ones. If you are using Java8, then filter on the isUpperCase()
method.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.