package ceylon.language;

import com.redhat.ceylon.compiler.java.metadata.Annotation;
import com.redhat.ceylon.compiler.java.metadata.Annotations;
import com.redhat.ceylon.compiler.java.metadata.Ceylon;
import com.redhat.ceylon.compiler.java.metadata.Name;
import com.redhat.ceylon.compiler.java.metadata.SatisfiedTypes;
import com.redhat.ceylon.compiler.java.metadata.TypeInfo;
import com.redhat.ceylon.compiler.java.metadata.TypeParameter;
import com.redhat.ceylon.compiler.java.metadata.TypeParameters;
import com.redhat.ceylon.compiler.java.metadata.Variance;

@Ceylon(major = 2)
@TypeParameters(@TypeParameter(value = "Element", variance = Variance.OUT))
@SatisfiedTypes({"ceylon.language.Collection<Element>",
                 "ceylon.language.Correspondence<ceylon.language.Integer,Element>",
                 "ceylon.language.Ranged<ceylon.language.Integer,ceylon.language.List<Element>>",
                 "ceylon.language.Cloneable<ceylon.language.List<Element>>"})
public interface List<Element> 
        extends Collection<Element>, 
                Correspondence<Integer,Element>,
                Ranged<Integer, List<? extends Element>> {

    @Annotations(@Annotation("formal"))
    @TypeInfo("ceylon.language.Nothing|ceylon.language.Integer")
    public Integer getLastIndex();
    
    @Annotations({@Annotation("actual"), @Annotation("default")})
    @Override
    public long getSize();
    
    @Annotations({@Annotation("actual"), @Annotation("default")})
    @Override
    public boolean defines(@Name("index") Integer key);
    
    @Annotations({@Annotation("actual"), @Annotation("formal")})
    @TypeInfo("ceylon.language.Nothing|Element")
    @Override
    public Element item(@Name("index") Integer key);
    
    @Annotations({@Annotation("actual"), @Annotation("default")})
    @TypeInfo("ceylon.language.Iterator<Element>")
    @Override
    public Iterator<? extends Element> getIterator();
    
    @Annotations({@Annotation("actual"), @Annotation("default")})
    @Override
    public boolean equals(@Name("that") @TypeInfo("ceylon.language.Object")
    java.lang.Object that);
    
    @Annotations({@Annotation("formal")})
    public List<? extends Element> getReversed();
    
    @Annotations({@Annotation("actual"), @Annotation("default")})
    @Override
    public int hashCode();
    
}

@@ -192,24 +192,80 @@
 ata.Ceylon;%0A
+import com.redhat.ceylon.compiler.java.metadata.Ignore;%0A
 import com.r
@@ -306,16 +306,16 @@
 a.Name;%0A
-
 import c
@@ -370,16 +370,75 @@
 dTypes;%0A
+import com.redhat.ceylon.compiler.java.metadata.Sequenced;%0A
 import c
@@ -1114,17 +1114,16 @@
 Element%3E
- 
 %0A       
@@ -1151,17 +1151,16 @@
 lement%3E,
- 
 %0A       
@@ -1397,29 +1397,25 @@
 astIndex();%0A
-    
 %0A
+
     @Annotat
@@ -1505,29 +1505,25 @@
  getSize();%0A
-    
 %0A
+
     @Annotat
@@ -1638,37 +1638,33 @@
 ) Integer key);%0A
-    
 %0A
+
     @Annotations
@@ -1828,21 +1828,17 @@
 r key);%0A
-    
 %0A
+
     @Ann
@@ -2010,29 +2010,25 @@
 Iterator();%0A
-    
 %0A
+
     @Annotat
@@ -2199,21 +2199,17 @@
  that);%0A
-    
 %0A
+
     @Ann
@@ -2238,24 +2238,71 @@
 %22formal%22)%7D)%0A
+    @TypeInfo(%22ceylon.language.List%3CElement%3E%22)%0A
     public L
@@ -2339,21 +2339,17 @@
 rsed();%0A
-    
 %0A
+
     @Ann
@@ -2447,15 +2447,750 @@
 Code();%0A
+%0A
     
+@Annotations(@Annotation(%22formal%22))%0A    @TypeParameters(@TypeParameter(%22Other%22))%0A    @TypeInfo(%22ceylon.language.List%3CElement%7COther%3E%22)%0A    public %3COther%3E List withLeading(@Name(%22elements%22)%0A            @TypeInfo(%22ceylon.language.Iterable%3COther%3E%22)%0A            @Sequenced Iterable%3C? extends Other%3E elements);%0A%0A    @Annotations(@Annotation(%22formal%22))%0A    @TypeParameters(@TypeParameter(%22Other%22))%0A    @TypeInfo(%22ceylon.language.List%3CElement%7COther%3E%22)%0A    public %3COther%3E List withTrailing(@Name(%22elements%22)%0A            @TypeInfo(%22ceylon.language.Iterable%3COther%3E%22)%0A            @Sequenced Iterable%3C? extends Other%3E elements);%0A%0A    @Ignore public List%3C? extends Element%3E withLeading();%0A    @Ignore public List%3C? extends Element%3E withTrailing();%0A
 %0A%7D%0A

Define withLeading/withTrailing