level 1
诺亚之心L
楼主
我需要用一个class模拟LinkedList。提供的是Entry class, 里面有三个field:E element, Entry next和 Entry prev。
next指向Linkedlist里的后一个entry,prev指向前一个。
我需要在list class的constructor 模拟linkedlist,这个list class有两个field: Entry head 和Entry tail,head代表linkedlist的第一,tail代表最后。constructor传入一个不知大小的array,我要怎么做,才能用entry全部把array里的东西全部提取出来,模拟一个linkedlist呢?
2018年10月20日 20点10分
1
next指向Linkedlist里的后一个entry,prev指向前一个。
我需要在list class的constructor 模拟linkedlist,这个list class有两个field: Entry head 和Entry tail,head代表linkedlist的第一,tail代表最后。constructor传入一个不知大小的array,我要怎么做,才能用entry全部把array里的东西全部提取出来,模拟一个linkedlist呢?