Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Utils {
- public static <T> void InsertNode (Node<T> lst, T val)
- {
- Node<T> node = new Node<T>(val);
- Node<T> curr = lst;
- while (curr.haveNext() != null)
- {
- curr = curr.getNext();
- }
- curr.setNext(node);
- }
- public static <T> int ListLength (Node<T> lst)
- {
- int count = 0;
- Node<T> curr = lst;
- while (curr.getNext != null)
- {
- count++;
- curr = curr.getNext;
- }
- return count;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement