>题目:[https://leetcode.cn/problems/palindrome-linked-list/](https://leetcode.cn/problems/palindrome-linked-list/)
>解题:[https://leetcode.cn/problems/palindrome-linked-list/solution/zhong-yong-xie-fa-by-yi-qi-he-fen-da-ov7k/](https://leetcode.cn/problems/palindrome-linked-list/solution/zhong-yong-xie-fa-by-yi-qi-he-fen-da-ov7k/)
### 解题思路
中庸写法:遍历head装入list,双指针检查list判断回文
### 执行结果
执行用时:7 ms, 在所有 Java 提交中击败了48.80%的用户
内存消耗:53.7 MB, 在所有 Java 提交中击败了74.98%的用户
### 代码
```java
/**
* Definition for singly-linked list.
* public class ListNode {
* int val;
* ListNode next;
* ListNode() {}
* ListNode(int val) { this.val = val; }
* ListNode(int val, ListNode next) { this.val = val; this.next = next; }
* }
*/
class Solution {
public boolean isPalindrome(ListNode head) {
List<Integer> list = new ArrayList<Integer>();
do{
list.add(head.val);
head = head.next;
}while (head!=null);
for (int i = 0,j=list.size()-1; i <=j ; i++,j--) {
if(!Objects.equals(list.get(i), list.get(j))){
return false;
}
}
return true;
}
}
```