@@ -0,0 +1,498 @@
+/**%0A * %0A */%0Apackage leetcode;%0A%0Aimport java.util.HashSet;%0Aimport java.util.Set;%0A%0A/**%0A * @author hzlinqien%0A *%0A */%0A%0Apublic class LinkedListCycle %7B%0A%0A%09public boolean hasCycle(ListNode head) %7B%0A%09%09Set%3CListNode%3E nodeMap = new HashSet%3C%3E();%0A%09%09for (ListNode temp = head; temp != null; temp = temp.next) %7B%0A%09%09%09if (nodeMap.contains(temp)) %7B%0A%09%09%09%09return true;%0A%09%09%09%7D%0A%09%09%09nodeMap.add(temp);%0A%09%09%7D%0A%09%09return false;%0A%09%7D%0A%0A%09class ListNode %7B%0A%09%09int val;%0A%09%09ListNode next;%0A%0A%09%09ListNode(int x) %7B%0A%09%09%09val = x;%0A%09%09%09next = null;%0A%09%09%7D%0A%09%7D%0A%7D%0A

Add LinkedListCycle.java