dsa

Data Structures & Algorithms - Spring 2018
Log | Files | Refs | README

ListArrayListBasedPlus.java (471B)


      1 package lab2;
      2 
      3 import java.util.Collections;
      4 
      5 public class ListArrayListBasedPlus extends ListArrayListBased {
      6 
      7     public void reverse() {
      8         Collections.reverse(items);
      9     }
     10 
     11         @Override
     12     public String toString() {
     13         String result = "List of size " + size() + " has the following items : ";
     14 
     15         for (int i = 0; i < size(); i++) {
     16             if (get(i)!= null)
     17                 result += get(i) + " ";
     18         }
     19 
     20         return result;
     21     }
     22 }