{"id":168129,"date":"2013-02-03T20:18:03","date_gmt":"2013-02-03T16:18:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=168129"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=168129","title":{"rendered":"<span class=\"post_title\">DoubleArrayList &mdash; \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f java.util.List<\/span>"},"content":{"rendered":"<div class=\"content html_format\">   \t\u041d\u0435 \u0442\u0430\u043a \u0434\u0430\u0432\u043d\u043e \u044f \u0441\u0447\u0438\u0442\u0430\u043b. \u0447\u0442\u043e \u043d\u0435\u0442 \u043e\u043f\u0440\u0430\u0432\u0434\u0430\u043d\u0438\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044e <code>java.util.LinkedList<\/code> \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 <code>java.util.List<\/code>. \u041d\u043e \u0447\u0442\u043e-\u0442\u043e \u0437\u0430\u0441\u0442\u0430\u0432\u0438\u043b\u043e \u043c\u0435\u043d\u044f \u0435\u0433\u043e \u043f\u043e\u0438\u0441\u043a\u0430\u0442\u044c. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c\u0441\u044f. \u041b\u044e\u0431\u043e\u0439 \u0433\u0440\u0430\u043c\u043e\u0442\u043d\u044b\u0439 Java-\u0441\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0441\u0442 \u0437\u043d\u0430\u0435\u0442, \u0447\u0442\u043e <code>java.util.ArrayList<\/code> \u043d\u0443\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u043e\u0433\u0434\u0430, \u043a\u043e\u0433\u0434\u0430 \u043d\u0430\u043c \u043d\u0443\u0436\u0435\u043d \u0431\u044b\u0441\u0442\u0440\u044b\u0439 \u0434\u043e\u0441\u0442\u0443\u043f \u043f\u043e \u0438\u043d\u0434\u0435\u043a\u0441\u0443, \u0430 <code>java.util.LinkedList<\/code>, \u0435\u0441\u043b\u0438 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u0438\u043b\u0438 \u0443\u0434\u0430\u043b\u044f\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0432 \u0441\u0435\u0440\u0435\u0434\u0438\u043d\u0435 \u0441\u043f\u0438\u0441\u043a\u0430. \u041d\u0435 \u043c\u043d\u043e\u0433\u0438\u0435 \u0438\u0437 \u043d\u0438\u0445 \u0434\u043e\u0433\u0430\u0434\u044b\u0432\u0430\u044e\u0442\u0441\u044f, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u0438\u043b\u0438 \u0443\u0434\u0430\u043b\u044f\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0432 \u0441\u0435\u0440\u0435\u0434\u0438\u043d\u0435 \u0441\u043f\u0438\u0441\u043a\u0430 \u043c\u0435\u0442\u043e\u0434\u0430\u043c\u0438 <code>remove(int index)<\/code> \u0438 <code>add(int index, E element)<\/code>, \u0442\u043e \u043d\u0430 \u043f\u043e\u0438\u0441\u043a \u043d\u0443\u0436\u043d\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u0442\u0440\u0430\u0447\u0435\u043d\u043e \u0432\u0440\u0435\u043c\u044f \u0432 \u0441\u0440\u0435\u0434\u043d\u0435\u043c \u043f\u0440\u043e\u043f\u043e\u0440\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0435 \u0440\u0430\u0437\u043c\u0435\u0440\u0443 \u0441\u043f\u0438\u0441\u043a\u0430 <code>O(N)<\/code>. \u0422\u0430\u043a \u043a\u043e\u0433\u0434\u0430 \u0436\u0435 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0432\u044b\u0433\u043e\u0434\u0430 \u043e\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f <code>java.util.LinkedList<\/code>?<br \/>  <a name=\"habracut\"><\/a><br \/>  \u041f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u0438\u0442\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u0432. \u0422\u043e\u0447\u043d\u0435\u0435 \u043a\u043e\u0433\u0434\u0430 \u0432\u044b \u0443\u0434\u0430\u043b\u044f\u0435\u0442\u0435 \u0438\u043b\u0438 \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0447\u0435\u0440\u0435\u0437 <code>java.util.ListIterator<\/code>. \u0412 \u043a\u043e\u043d\u0446\u0435-\u043a\u043e\u043d\u0446\u043e\u0432, \u0432 \u043f\u043e\u0438\u0441\u043a\u0430\u0445 \u043e\u043f\u0440\u0430\u0432\u0434\u0430\u043d\u0438\u044f \u044f \u043d\u0430\u0448\u0435\u043b \u0432\u043f\u043e\u043b\u043d\u0435 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u0434\u0430, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u043c <code>java.util.LinkedList<\/code> \u0434\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u043e \u043f\u0435\u0440\u0435\u0434 <code>java.util.ArrayList<\/code>. \u042d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0438\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443\u0434\u0430\u043b\u044f\u0435\u0442 \u0438\u0437 \u0441\u043f\u0438\u0441\u043a\u0430 \u0432\u0441\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b, \u043d\u0435 \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u044f\u044e\u0449\u0438\u0435 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u043c\u0443 \u0443\u0441\u043b\u043e\u0432\u0438\u044e.<\/p>\n<pre><code class=\"java\">for (Iterator&lt;E&gt; i = list.iterator(); i.hasNext(); ) {     E val = i.next();     if (!condition(val)) {         i.remove();     } }<\/code><\/pre>\n<p>  \u042d\u0442\u043e\u0442 \u0436\u0435 \u043a\u043e\u0434 \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u0430\u0442\u044c \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0441\u043f\u0438\u0441\u043a\u0430 \u0438 \u0442\u043e\u0433\u0434\u0430 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0441 <code>java.util.ArrayList<\/code>, \u043a\u0430\u043a \u043c\u0438\u043d\u0438\u043c\u0443\u043c, \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0438\u043c\u0435\u0442\u044c \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0438\u0447\u043d\u0443\u044e \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c \u043e\u0442 \u043f\u0435\u0440\u0432\u043e\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430.<\/p>\n<pre><code class=\"java\">List&lt;E&gt; list1 = new ArrayList&lt;E&gt;(); for (Iterator&lt;E&gt; i = list.iterator(); i.hasNext(); ) {     E val = i.next();     if (condition(val)) {         list1.add(val);     } } list.clear(); list.addAll(list1);<\/code><\/pre>\n<p>  \u041d\u043e \u044d\u0442\u043e \u0436\u0435 \u043d\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e, \u0447\u0442\u043e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u0438\u043a\u0442\u0443\u044e\u0442 \u043d\u0430\u043c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c. \u041d\u043e \u0438\u043c\u0435\u043d\u043d\u043e \u044d\u0442\u043e\u0442 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043d\u0430\u0432\u0435\u043b \u043c\u0435\u043d\u044f \u043d\u0430 \u043c\u044b\u0441\u043b\u044c, \u043a\u0430\u043a \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0437\u0430 \u0432\u0440\u0435\u043c\u044f <code>O(1)<\/code>.<\/p>\n<p>  \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0434\u043e\u043f\u0443\u0449\u0435\u043d\u0438\u0435: \u00ab\u041e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0432\u0441\u0442\u0430\u0432\u043a\u0438 \u0438 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u044f\u0442 \u0440\u044f\u0434\u043e\u043c.\u00bb \u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044e, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0432\u0441\u0442\u0430\u0432\u043a\u0438 \u0438 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u0431\u0443\u0434\u0443\u0442 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442\u044c \u0445\u0430\u043e\u0442\u0438\u0447\u043d\u043e, \u043d\u043e \u0432 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0430\u0441 \u043d\u0435 \u0441\u043f\u0430\u0441\u0435\u0442 \u043d\u0438 <code>java.util.ArrayList<\/code>, \u043d\u0438 <code>java.util.LinkedList<\/code>, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u043c\u044b \u0441\u0440\u0430\u0436\u0430\u0435\u043c\u0441\u044f. \u0412\u0435\u0434\u044c \u0447\u0442\u043e\u0431\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0438\u043b\u0438 \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 <code>java.util.ArrayList<\/code> \u0434\u043e\u043b\u0436\u0435\u043d \u0432 \u043e\u0431\u0449\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0441\u0434\u0432\u0438\u043d\u0443\u0442\u044c \u0432 \u043c\u0430\u0441\u0441\u0438\u0432\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043f\u0440\u043e\u043f\u043e\u0440\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0435 \u0440\u0430\u0437\u043c\u0435\u0440\u0443 O(N), \u0430 <code>java.util.LinkedList<\/code> \u0434\u043e\u043b\u0436\u0435\u043d \u0435\u0433\u043e \u043d\u0430\u0439\u0442\u0438 <code>O(N)<\/code>.<\/p>\n<p>  \u0418\u0434\u0435\u044f \u0442\u0430\u043a\u043e\u0432\u0430. \u0421\u043f\u0438\u0441\u043e\u043a \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u043d\u0435 \u0432 \u043e\u0434\u043d\u043e\u043c \u043c\u0430\u0441\u0441\u0438\u0432\u0435, \u0430 \u0432 2\u0445. \u041f\u0440\u0438\u0447\u0435\u043c, \u043a\u0430\u0436\u0434\u044b\u0439 \u043c\u0430\u0441\u0441\u0438\u0432 \u043c\u043e\u0436\u0435\u0442 \u0432\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0435\u0433\u043e \u0446\u0435\u043b\u0438\u043a\u043e\u043c.<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/img-fotki.yandex.ru\/get\/5640\/19578065.d\/0_aa22b_4a1ec318_L.jpg\" alt=\"\u041f\u0435\u0440\u0435\u0434 \u0432\u0441\u0442\u0430\u0432\u043a\u043e\u0439\"\/><\/p>\n<p>  \u041f\u0440\u0438 \u0432\u0441\u0442\u0430\u0432\u043a\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u0432 \u0441\u0435\u0440\u0435\u0434\u0438\u043d\u0443 \u0441\u043f\u0438\u0441\u043a\u0430, \u043c\u044b \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0435\u0433\u043e \u0432 \u0440\u0430\u0437\u0440\u044b\u0432. \u041d\u043e \u0432\u0435\u0434\u044c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0437\u0430\u0445\u043e\u0442\u0435\u0442\u044c \u0432\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u043d\u0435 \u0442\u0443\u0434\u0430 \u0433\u0434\u0435 \u0443 \u043d\u0430\u0441 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0430\u0435\u043c \u0447\u0430\u0441\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432, \u0447\u0442\u043e\u0431\u044b \u0440\u0430\u0437\u0440\u044b\u0432 \u0441\u0434\u0432\u0438\u043d\u0443\u043b\u0441\u044f \u0432 \u043d\u0443\u0436\u043d\u043e \u043c\u0435\u0441\u0442\u043e.<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/img-fotki.yandex.ru\/get\/6426\/19578065.d\/0_aa22a_d1481f57_L.jpg\" alt=\"\u041f\u043e\u0441\u043b\u0435 \u0432\u0441\u0442\u0430\u0432\u043a\u0438\"\/><\/p>\n<p>  \u0412\u044b \u0441\u043a\u0430\u0436\u0435\u0442\u0435: \u00ab\u0414\u0430, \u043c\u044b \u0441\u0434\u0432\u0438\u043d\u0443\u043b\u0438 \u043c\u0435\u043d\u044c\u0448\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432, \u0447\u0435\u043c \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0441 <code>java.util.ArrayList<\/code>, \u043d\u043e \u043e\u043d\u043e \u0432\u0441\u0451 \u0440\u0430\u0432\u043d\u043e \u043f\u0440\u043e\u043f\u043e\u0440\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0443 \u0441\u043f\u0438\u0441\u043a\u0430.\u00bb \u0412\u044b \u043f\u0440\u0430\u0432\u044b, \u043d\u043e \u0435\u0441\u043b\u0438 \u0432\u0441\u043f\u043e\u043c\u043d\u0438\u0442\u044c \u043e \u043d\u0430\u0448\u0435\u043c \u0434\u043e\u043f\u0443\u0449\u0435\u043d\u0438\u0438, \u0442\u043e \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437, \u043a\u0440\u043e\u043c\u0435 \u043f\u0435\u0440\u0432\u043e\u0433\u043e, \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0434\u0432\u0438\u0433\u0430\u0442\u044c \u043d\u0435\u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432.<\/p>\n<p>  \u0422\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0438 \u043f\u0440\u0438 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0438. \u0420\u0430\u0437\u0440\u044b\u0432 \u0441\u043c\u0435\u0449\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u0442\u043e \u043c\u0435\u0441\u0442\u043e, \u043e\u0442\u043a\u0443\u0434\u0430 \u0431\u044b\u043b \u0443\u0434\u0430\u043b\u0435\u043d \u044d\u043b\u0435\u043c\u0435\u043d\u0442.<\/p>\n<p>  \u042f \u0431\u044b\u0441\u0442\u0440\u0435\u043d\u044c\u043a\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u044d\u0442\u043e\u0433\u043e \u0441\u043f\u0438\u0441\u043a\u0430. \u0418 \u043f\u0440\u043e\u0433\u043d\u0430\u043b \u0442\u0435\u0441\u0442\u044b: \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435, \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435, \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u043e \u0438\u043d\u0434\u0435\u043a\u0441\u0443, \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u044f, \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0432\u0441\u0435\u0433\u043e \u0441\u043f\u0438\u0441\u043a\u0430 \u0441 \u0433\u043e\u043b\u043e\u0432\u044b \u043f\u043e \u043e\u0434\u043d\u043e\u043c\u0443 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0443. \u0422.\u043a. \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0441\u0438\u043b\u044c\u043d\u043e \u0440\u0430\u0437\u043d\u044f\u0442\u0441\u044f \u0434\u043b\u044f \u0440\u0430\u0437\u043d\u044b\u0445 \u0441\u043f\u0438\u0441\u043a\u043e\u0432, \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0445 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0441\u043b\u043e\u0436\u043d\u043e. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u043a\u0430\u0436\u0443 \u0442\u0430\u0431\u043b\u0438\u0446\u044b. \u0413\u0440\u0430\u0444\u0438\u043a\u0438 \u0431\u0443\u0434\u0443\u0442, \u043d\u043e \u043f\u043e\u0437\u0436\u0435.<\/p>\n<h3>ArrayList<\/h3>\n<p>  <\/p>\n<table>\n<tr>\n<td>20000<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>94<\/td>\n<td>47<\/td>\n<\/tr>\n<tr>\n<td>40000<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>406<\/td>\n<td>187<\/td>\n<\/tr>\n<tr>\n<td>60000<\/td>\n<td>16<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>891<\/td>\n<td>437<\/td>\n<\/tr>\n<tr>\n<td>80000<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>1578<\/td>\n<td>782<\/td>\n<\/tr>\n<tr>\n<td>100000<\/td>\n<td>0<\/td>\n<td>15<\/td>\n<td>0<\/td>\n<td>2453<\/td>\n<td>1219<\/td>\n<\/tr>\n<tr>\n<td>120000<\/td>\n<td>16<\/td>\n<td>0<\/td>\n<td>15<\/td>\n<td>3516<\/td>\n<td>1750<\/td>\n<\/tr>\n<tr>\n<td>140000<\/td>\n<td>16<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>4796<\/td>\n<td>2391<\/td>\n<\/tr>\n<tr>\n<td>160000<\/td>\n<td>16<\/td>\n<td>0<\/td>\n<td>15<\/td>\n<td>6219<\/td>\n<td>3125<\/td>\n<\/tr>\n<tr>\n<td>180000<\/td>\n<td>16<\/td>\n<td>0<\/td>\n<td>15<\/td>\n<td>7969<\/td>\n<td>3984<\/td>\n<\/tr>\n<tr>\n<td>200000<\/td>\n<td>63<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>9859<\/td>\n<td>4844<\/td>\n<\/tr>\n<\/table>\n<p>  \u041a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0432\u0438\u0434\u0435\u0442\u044c \u0438\u0437 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, <code>java.util.ArrayList<\/code> \u043e\u0442\u043b\u0438\u0447\u043d\u043e \u0441\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441 \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435\u043c \u0438 \u043b\u044e\u0431\u044b\u043c \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c, \u0430 \u043d\u0430 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f\u0445 \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u0438 \u0438 \u0434\u0430\u0436\u0435 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u0441\u043f\u0438\u0441\u043a\u0430 \u0441 \u0433\u043e\u043b\u043e\u0432\u044b \u0442\u0435\u0440\u043f\u0438\u0442 \u0441\u043e\u043a\u0440\u0443\u0448\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u043f\u043e\u0440\u0430\u0436\u0435\u043d\u0438\u0435.<\/p>\n<h3>LinkedList<\/h3>\n<p>  <\/p>\n<table>\n<tr>\n<td>20000<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>406<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<\/tr>\n<tr>\n<td>40000<\/td>\n<td>31<\/td>\n<td>0<\/td>\n<td>1985<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<\/tr>\n<tr>\n<td>60000<\/td>\n<td>15<\/td>\n<td>0<\/td>\n<td>3828<\/td>\n<td>16<\/td>\n<td>0<\/td>\n<\/tr>\n<tr>\n<td>80000<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>8359<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<\/tr>\n<tr>\n<td>100000<\/td>\n<td>16<\/td>\n<td>0<\/td>\n<td>24891<\/td>\n<td>0<\/td>\n<td>15<\/td>\n<\/tr>\n<tr>\n<td>120000<\/td>\n<td>16<\/td>\n<td>0<\/td>\n<td>43562<\/td>\n<td>16<\/td>\n<td>0<\/td>\n<\/tr>\n<tr>\n<td>140000<\/td>\n<td>16<\/td>\n<td>15<\/td>\n<td>52985<\/td>\n<td>0<\/td>\n<td>15<\/td>\n<\/tr>\n<tr>\n<td>160000<\/td>\n<td>16<\/td>\n<td>0<\/td>\n<td>57047<\/td>\n<td>15<\/td>\n<td>0<\/td>\n<\/tr>\n<tr>\n<td>180000<\/td>\n<td>79<\/td>\n<td>0<\/td>\n<td>121531<\/td>\n<td>0<\/td>\n<td>15<\/td>\n<\/tr>\n<tr>\n<td>200000<\/td>\n<td>32<\/td>\n<td>15<\/td>\n<td>152250<\/td>\n<td>16<\/td>\n<td>16<\/td>\n<\/tr>\n<\/table>\n<p>  \u0421\u043b\u0430\u0431\u044b\u043c \u043c\u0435\u0441\u0442\u043e\u043c <code>java.util.LinkedList<\/code> \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0434\u043e\u0441\u0442\u0443\u043f \u043f\u043e \u0438\u043d\u0434\u0435\u043a\u0441\u0443, \u0430 \u0432\u043e\u0442 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0437\u0430\u043c\u0435\u0442\u043d\u043e \u0431\u044b\u0441\u0442\u0440\u0435\u0435.<\/p>\n<h3>DoubleArrayList<\/h3>\n<p>  <\/p>\n<table>\n<tr>\n<td>20000<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<\/tr>\n<tr>\n<td>40000<\/td>\n<td>16<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<\/tr>\n<tr>\n<td>60000<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>15<\/td>\n<td>0<\/td>\n<\/tr>\n<tr>\n<td>80000<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>16<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<\/tr>\n<tr>\n<td>100000<\/td>\n<td>16<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>15<\/td>\n<td>0<\/td>\n<\/tr>\n<tr>\n<td>120000<\/td>\n<td>16<\/td>\n<td>0<\/td>\n<td>0<\/td>\n<td>15<\/td>\n<td>0<\/td>\n<\/tr>\n<tr>\n<td>140000<\/td>\n<td>16<\/td>\n<td>16<\/td>\n<td>0<\/td>\n<td>15<\/td>\n<td>0<\/td>\n<\/tr>\n<tr>\n<td>160000<\/td>\n<td>16<\/td>\n<td>16<\/td>\n<td>0<\/td>\n<td>15<\/td>\n<td>0<\/td>\n<\/tr>\n<tr>\n<td>180000<\/td>\n<td>47<\/td>\n<td>16<\/td>\n<td>0<\/td>\n<td>15<\/td>\n<td>0<\/td>\n<\/tr>\n<tr>\n<td>200000<\/td>\n<td>32<\/td>\n<td>0<\/td>\n<td>15<\/td>\n<td>0<\/td>\n<td>16<\/td>\n<\/tr>\n<\/table>\n<p>  \u041d\u0443 \u0438, \u043d\u0430\u043a\u043e\u043d\u0435\u0446, \u043c\u043e\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438 <code>org.kefirsf.list.DoubleArrayList<\/code> \u043d\u0435 \u043f\u0440\u043e\u0441\u0435\u0434\u0430\u0435\u0442 \u043d\u0438 \u043d\u0430 \u043e\u0434\u043d\u043e\u043c \u0438\u0437 \u0442\u0435\u0441\u0442\u043e\u0432.<\/p>\n<h1>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u0440\u0430\u0432\u043d\u0438\u043c \u0441 LinkedList \u043d\u0430 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043e\u0431\u044a\u0435\u043c\u0430\u0445.<\/h1>\n<p>  <\/p>\n<h3>\u0417\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435<\/h3>\n<p>  <img decoding=\"async\" src=\"http:\/\/img-fotki.yandex.ru\/get\/4133\/19578065.d\/0_aa232_2d369908_XL.jpg\" alt=\"image\"\/>  <\/p>\n<h3>\u0424\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u044f<\/h3>\n<p>  <img decoding=\"async\" src=\"http:\/\/img-fotki.yandex.ru\/get\/6434\/19578065.d\/0_aa230_9a5c7f7d_XL.jpg\" alt=\"image\"\/>  <\/p>\n<h3>\u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0441 \u0433\u043e\u043b\u043e\u0432\u044b<\/h3>\n<p>  <img decoding=\"async\" src=\"http:\/\/img-fotki.yandex.ru\/get\/6443\/19578065.d\/0_aa231_bc326461_XL.jpg\" alt=\"image\"\/><br \/>  \u0418\u0437 \u0432\u0441\u0435\u0445 \u044d\u0442\u0438\u0445 \u0433\u0440\u0430\u0444\u0438\u043a\u043e\u0432 \u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u043d\u0430 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f\u0445 <code>DoubleArrayList<\/code> \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0437\u0430 \u0432\u0440\u0435\u043c\u044f \u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u0438\u043c\u043e\u0435 \u0441 <code>java.util.LinkedList<\/code>. \u041f\u0443\u0441\u0442\u044c \u0434\u0430\u0436\u0435 \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u043b\u0443\u0447\u0448\u0435. \u0413\u043b\u0430\u0432\u043d\u043e\u0435, \u0447\u0442\u043e \u043d\u0435 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0438\u0447\u043d\u043e\u0439 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u043c\u0430\u0441\u0441\u0438\u0432\u0430, \u0430 \u0432\u0441\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u0437\u0430 <code>O(N)<\/code>, \u0430 \u044d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442, \u0447\u0442\u043e \u0435\u0434\u0438\u043d\u0438\u0447\u043d\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0432 \u0441\u0440\u0435\u0434\u043d\u0435\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u0437\u0430 <code>O(1)<\/code>. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0446\u0435\u043b\u044c \u0434\u043e\u0441\u0442\u0438\u0433\u043d\u0443\u0442\u0430.<\/p>\n<p>  \u041a\u043e\u0434 <code>org.kefirsf.list.DoubleArrayList<\/code> \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u043d\u0430 GitHub: <a href=\"https:\/\/github.com\/kefirfromperm\/multi-array-list\">github.com\/kefirfromperm\/multi-array-list<\/a><br \/>  <b>\u041f\u0440\u0435\u0434\u043e\u0441\u0442\u0435\u0440\u0435\u0436\u0435\u043d\u0438\u0435:<\/b> \u043d\u0435 \u043f\u044b\u0442\u0430\u0439\u0442\u0435\u0441\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0432 \u043f\u0440\u043e\u043c\u044b\u0448\u043b\u0435\u043d\u043d\u043e\u0439 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435. <code>org.kefirsf.list.DoubleArrayList<\/code> \u0435\u0449\u0451 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0445\u043e\u0440\u043e\u0448\u043e \u043f\u043e\u043a\u0440\u044b\u0442 \u0442\u0435\u0441\u0442\u0430\u043c\u0438, \u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442\u044c \u043a \u0443\u0442\u0435\u0447\u043a\u0430\u043c \u043f\u0430\u043c\u044f\u0442\u0438.    \t \t\t   \t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/168129\/\"> http:\/\/habrahabr.ru\/post\/168129\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">   \t\u041d\u0435 \u0442\u0430\u043a \u0434\u0430\u0432\u043d\u043e \u044f \u0441\u0447\u0438\u0442\u0430\u043b. \u0447\u0442\u043e \u043d\u0435\u0442 \u043e\u043f\u0440\u0430\u0432\u0434\u0430\u043d\u0438\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044e <code>java.util.LinkedList<\/code> \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 <code>java.util.List<\/code>. \u041d\u043e \u0447\u0442\u043e-\u0442\u043e \u0437\u0430\u0441\u0442\u0430\u0432\u0438\u043b\u043e \u043c\u0435\u043d\u044f \u0435\u0433\u043e \u043f\u043e\u0438\u0441\u043a\u0430\u0442\u044c. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c\u0441\u044f. \u041b\u044e\u0431\u043e\u0439 \u0433\u0440\u0430\u043c\u043e\u0442\u043d\u044b\u0439 Java-\u0441\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0441\u0442 \u0437\u043d\u0430\u0435\u0442, \u0447\u0442\u043e <code>java.util.ArrayList<\/code> \u043d\u0443\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u043e\u0433\u0434\u0430, \u043a\u043e\u0433\u0434\u0430 \u043d\u0430\u043c \u043d\u0443\u0436\u0435\u043d \u0431\u044b\u0441\u0442\u0440\u044b\u0439 \u0434\u043e\u0441\u0442\u0443\u043f \u043f\u043e \u0438\u043d\u0434\u0435\u043a\u0441\u0443, \u0430 <code>java.util.LinkedList<\/code>, \u0435\u0441\u043b\u0438 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u0438\u043b\u0438 \u0443\u0434\u0430\u043b\u044f\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0432 \u0441\u0435\u0440\u0435\u0434\u0438\u043d\u0435 \u0441\u043f\u0438\u0441\u043a\u0430. \u041d\u0435 \u043c\u043d\u043e\u0433\u0438\u0435 \u0438\u0437 \u043d\u0438\u0445 \u0434\u043e\u0433\u0430\u0434\u044b\u0432\u0430\u044e\u0442\u0441\u044f, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u0438\u043b\u0438 \u0443\u0434\u0430\u043b\u044f\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0432 \u0441\u0435\u0440\u0435\u0434\u0438\u043d\u0435 \u0441\u043f\u0438\u0441\u043a\u0430 \u043c\u0435\u0442\u043e\u0434\u0430\u043c\u0438 <code>remove(int index)<\/code> \u0438 <code>add(int index, E element)<\/code>, \u0442\u043e \u043d\u0430 \u043f\u043e\u0438\u0441\u043a \u043d\u0443\u0436\u043d\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u0442\u0440\u0430\u0447\u0435\u043d\u043e \u0432\u0440\u0435\u043c\u044f \u0432 \u0441\u0440\u0435\u0434\u043d\u0435\u043c \u043f\u0440\u043e\u043f\u043e\u0440\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0435 \u0440\u0430\u0437\u043c\u0435\u0440\u0443 \u0441\u043f\u0438\u0441\u043a\u0430 <code>O(N)<\/code>. \u0422\u0430\u043a \u043a\u043e\u0433\u0434\u0430 \u0436\u0435 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0432\u044b\u0433\u043e\u0434\u0430 \u043e\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f <code>java.util.LinkedList<\/code>?  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-168129","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/168129","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=168129"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/168129\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=168129"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=168129"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=168129"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}