Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. public Integer get(Integer index) {
  2. if (first == null) {
  3. return null;
  4. }
  5. MyNode curNode = first;
  6. while (index >= 0) {
  7. if (index == 0) {
  8. return curNode == null ? null : curNode.getValue();
  9. } else {
  10. curNode = curNode == null ? null : curNode.getNext();
  11. index--;
  12. }
  13. }
  14. return null;
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement