mirror of
https://github.com/krahets/hello-algo.git
synced 2025-07-24 10:14:44 +08:00
Format the Java codes with the Reat Hat extension.
This commit is contained in:
@ -6,9 +6,7 @@
|
||||
|
||||
package include;
|
||||
|
||||
/**
|
||||
* Definition for a singly-linked list node
|
||||
*/
|
||||
/* Definition for a singly-linked list node */
|
||||
public class ListNode {
|
||||
public int val;
|
||||
public ListNode next;
|
||||
@ -16,12 +14,8 @@ public class ListNode {
|
||||
public ListNode(int x) {
|
||||
val = x;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a linked list with an array
|
||||
* @param arr
|
||||
* @return
|
||||
*/
|
||||
|
||||
/* Generate a linked list with an array */
|
||||
public static ListNode arrToLinkedList(int[] arr) {
|
||||
ListNode dum = new ListNode(0);
|
||||
ListNode head = dum;
|
||||
@ -32,12 +26,7 @@ public class ListNode {
|
||||
return dum.next;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list node with specific value from a linked list
|
||||
* @param head
|
||||
* @param val
|
||||
* @return
|
||||
*/
|
||||
/* Get a list node with specific value from a linked list */
|
||||
public static ListNode getListNode(ListNode head, int val) {
|
||||
while (head != null && head.val != val) {
|
||||
head = head.next;
|
||||
|
Reference in New Issue
Block a user