Subject: [DISCUSS] changes to registerInterest API

  Jason Huynh 2017-11-16, 23:36
  Anilkumar Gingade 2017-11-17, 00:03
  Michael Stolz 2017-11-17, 00:34
  Dan Smith 2017-11-17, 01:20
  Jacob Barrett 2017-11-17, 02:50
  Jason Huynh 2017-11-17, 17:23
  John Blum 2017-11-17, 18:03
  Jacob Barrett 2017-11-17, 19:32
  Jason Huynh 2017-11-17, 19:44
This...

> The Iterable version would handle any collection type by having the user pass
in the iterator for the collection.

Is not correct.

The Collection<E> interface itself "extends" the java.lang.Iterable<E>
interface (see here...
https://docs.oracle.com/javase/8/docs/api/java/util/Collection.html under "*All
Superinterfaces*").

Therefore a user can simply to this...

*List*<KeyType> keys = ...

region.registerInterest(keys); *// calls the
Region.registerInterest(:Iterable<T>) method.*

Alternatively, this would also be allowed...

*Set*<KeyType> keys = ...

region.registerInterest(keys);
On Fri, Nov 17, 2017 at 11:44 AM, Jason Huynh <[EMAIL PROTECTED]> wrote:

> Current idea is to:
> - deprecate current "ALL_KEYS" and List passing behavior in
> registerInterest()
> - add registerInterestAllKeys();
> - add registerInterest(T... keys) and registerInterest(Iterable<T>keys)
> and
> not have one specifically for List or specific collections.
>
> The Iterable version would handle any collection type by having the user
> pass in the iterator for the collection.
>
> On Fri, Nov 17, 2017 at 11:32 AM Jacob Barrett <[EMAIL PROTECTED]>
> wrote:
>
> > I am failing to see where registerInterest(List<T> keys) is an issue for
> > the key type in the region. If our region is Region<String> then I would
> > expect registerInterest(List<String>). If the keys are unknown or a mix
> > then you should have Region<Object> and thus
> registerInterest(List<Object).
> >
> > I echo John's statements on VarArgs and type erasure as well as his
> > argument for Iterable<T>.
> >
> > Also, List<T> does not restrict you from List indexes. The region would
> be
> > Region<List<String>> with registerInterest<List<List<String>>().
> >
> > -Jake
> >
> >
> > On Fri, Nov 17, 2017 at 10:04 AM John Blum <[EMAIL PROTECTED]> wrote:
> >
> > > Personally, I prefer the var args method (registerInterest(T... keys))
> > > myself.  It is way more convenient if I only have a few keys when
> calling
> > > this method then to have to add the keys to a List, especially for
> > testing
> > > purposes.
> > >
> > > But, I typically like to pair that with a registerInterest(Iterable<T>
> > > keys) method
> > > as well.  By having a overloaded Iterable variant, then I can pass in
> any
> > > Collection type I want (which shouldn't be restricted to just List).
> It
> > > also is a simple matter to convert any *Collection* (i.e. *List*,
> *Set*,
> > > etc) to an array, which can be passed to the var args method.  By using
> > > List,
> > > you are implying that "order matters" since a List is a order
> collection
> > of
> > > elements.
> > >
> > > This ("*It might even cause problems of pushing in **multiple different
> > > types.*"), regarding var args, does not even make sense. Technically,
> > > List<T> is no different.  Java's type erasure essentially equates var
> > args
> > > too "Object..." (or Object[]) and the List<T> to List (or a List of
> > > Objects,
> > > essentially like if you just did this... List<Object>) So, while the
> > > compiler ensures compile-time type-safety of generics, there is no
> > generics
> > > type-safety guarantees at runtime.
> > >
> > >
> > >
> > > On Fri, Nov 17, 2017 at 9:22 AM, Jason Huynh <[EMAIL PROTECTED]>
> wrote:
> > >
> > > > Hi Mike,
> > > >
> > > > The current support for List leads to compilation issues if the
> region
> > is
> > > > type constrained.  However I think you are suggesting instead of a
> var
> > > args
> > > > method, instead provide a registerInterest(List keys) method?
> > > >
> > > > So far what I am hearing requested is:
> > > > deprecate current "ALL_KEYS" and List passing behavior
> > > > registerInterestAllKeys();
> > > > registerInterest(List<T> keys) instead of a registerInterest(T...
> keys)
> > > >
> > > > Will anyone ever actually have a List as the key itself? The current
> > and
> > > > suggested changes would not allow it registering for a specific List
> > > > object.
> > > >
> > > >
> > > >
> > > > On Thu, Nov 16, 2017 at 6:50 PM Jacob Barrett <[EMAIL PROTECTED]>

-John
john.blum10101 (skype)
  Jason Huynh 2017-11-17, 21:24
  Kirk Lund 2017-11-20, 17:05
  Jason Huynh 2017-11-30, 22:25
  John Blum 2017-11-30, 22:30
  John Blum 2017-11-30, 22:33
  Jason Huynh 2017-11-30, 22:36
  John Blum 2017-11-30, 22:45
  Dan Smith 2017-11-30, 23:54
  Anthony Baker 2017-12-01, 15:55