Coder Social home page Coder Social logo

Comments (8)

GoogleCodeExporter avatar GoogleCodeExporter commented on August 29, 2024
One solution is to rename immutableList(E) and immutableList(E...) to
immutableListOf(E) and immutableListOf(E...).

Original comment by [email protected] on 11 Oct 2007 at 2:28

from google-collections.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 29, 2024
[deleted comment]

from google-collections.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 29, 2024
Good point. I especially wouldn't want to have just a small number of issues 
like
this be the only things preventing retrotranslated code from compiling!  (I 
hope it's
going to be only small.)

At this point I am thinking of immutableCopy() or immutableCopyOf().

Original comment by [email protected] on 16 Oct 2007 at 3:54

  • Changed title: Lists.immutableList(Iterable) should be named distinctly from immutableList(E) ; (E...)
  • Changed state: Accepted

from google-collections.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 29, 2024
The names I'm leaning toward now are

ImmutableArrayList.of()
and
ImmutableArrayList.copyOf()

and the same for ImmutableHashSet, and this is what I would submit to be in
java.util.  Any comments?

Original comment by [email protected] on 29 Nov 2007 at 1:18

from google-collections.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 29, 2024
Those names imply that you're returning an ArrayList. If the List contains 0 or 
1
elements, you might want to return a different class for optimal performance.

Original comment by [email protected] on 29 Nov 2007 at 2:22

from google-collections.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 29, 2024
You're right!  I should call the class ImmutableList (after all, an array is 
the only
sensible way you'd want to back it when n > 1 anyway, so 'array' in the name is
pointless).

Now, note that even my method named copyOf() is, I think, entitled to be 
sneaky; if
you pass it an ImmutableList instance it *won't* actually copy anything; it 
will just
return you the same instance.  I think this is ok and the name is still 
appropriate
because it's a copy in any way that can really matter.

Original comment by [email protected] on 29 Nov 2007 at 2:38

from google-collections.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 29, 2024
What about ImmutableList.of for a single element and ImmutableList.from for the 
Iterable?

Original comment by Ben.Lings on 11 Jan 2008 at 10:14

from google-collections.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 29, 2024
ImmutableList.from() is not a bad suggestion but we ended up sticking with 
copyOf().
 This code is pushed now so I'm closing the issue.  Thanks!

Original comment by [email protected] on 24 Mar 2008 at 8:25

  • Changed state: Fixed

from google-collections.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.