Closed GoogleCodeExporter closed 9 years ago
I could see this as being useful.
We could also have:
public interface Interner<E> implements Function<E, E>
Though I'm not sure whether we want com.google.common.collect to depend on
com.google.common.base, or the reverse.
Original comment by nev...@gmail.com
on 16 Aug 2010 at 9:09
Collect depends on base; that direction is fine, just not the other.
I don't like public types to implement Function, because I think an interner
should have one method, intern(). Not intern() and apply(). And as just
covered, Functions.forInterner() is not possible, but Interners.asFunction() is.
Original comment by kevinb@google.com
on 8 Sep 2010 at 6:37
> I don't like public types to implement Function, because I think an interner
should have one method, intern(). Not intern() and apply().
I totally agree. I made a mistake.
I checked the intern() signature before making my suggestion, making sure that
the argument and return types matched Function.apply() (especially considering
generics), but I missed the obvious *name* difference...
And, as you said, adding an apply() method just to obey the Function<T>
contract would be bad design. Renaming the intern() method would also be wrong:
we should not sacrifice clear method names for the sake of implementing the
Function<T> interface.
I think that an adapter such as Interners.asFunction(Interner) is the way to go.
Original comment by nev...@gmail.com
on 11 Sep 2010 at 8:37
Original comment by boppenh...@google.com
on 22 Sep 2010 at 11:17
Committed in r132.
Original comment by boppenh...@google.com
on 25 Sep 2010 at 12:20
Original comment by kevinb@google.com
on 18 Jan 2011 at 8:38
Original comment by kevinb@google.com
on 24 Jan 2011 at 9:33
This issue has been migrated to GitHub.
It can be found at https://github.com/google/guava/issues/<id>
Original comment by cgdecker@google.com
on 1 Nov 2014 at 4:15
Original comment by cgdecker@google.com
on 3 Nov 2014 at 9:09
Original issue reported on code.google.com by
ray.j.gr...@gmail.com
on 11 Aug 2010 at 11:43