Skip to content

Instantly share code, notes, and snippets.

@MLabusquiere
Created April 25, 2014 12:16
Show Gist options
  • Select an option

  • Save MLabusquiere/11287626 to your computer and use it in GitHub Desktop.

Select an option

Save MLabusquiere/11287626 to your computer and use it in GitHub Desktop.

Revisions

  1. MLabusquiere created this gist Apr 25, 2014.
    25 changes: 25 additions & 0 deletions UmodColTest
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,25 @@
    package fr.zenika.vertx.app.starter;

    import java.util.ArrayList;
    import java.util.Collection;
    import java.util.Collections;

    /**
    * @author M. Labusquière
    */
    public class TestCollectionMain {
    public static void main(String[] args) {
    Collection<String> col1 = getNewCol();
    Collection<String> col2 = getNewCol();

    System.out.println(col1.equals(col2)); //true
    System.out.println(Collections.unmodifiableCollection(col1).equals(col2));//false
    System.out.println(col1.equals(Collections.unmodifiableCollection(col2)));//false
    System.out.println(Collections.unmodifiableCollection(col1).equals(Collections.unmodifiableCollection(col2)));//false
    }

    public static Collection<String> getNewCol() {
    Collection<String> col = new ArrayList<>();
    return col;
    }
    }