[infinispan-dev] EntityLoader as interface?

Ales Justin ales.justin at gmail.com
Thu Sep 13 11:24:41 EDT 2012


While thinking about EntityLoader as interface (imo, it should be an interface ...), 
just stumbled upon this:

   public List<Object> load(EntityInfo... entityInfos) {
      int size = entityInfos.length;
      ArrayList<Object> list = new ArrayList<Object>(size);
      for (EntityInfo e : entityInfos) {
          Object entity = load(e);
          if (entity != null) {
              list.add(entity);
          }
      }
      return list;
   }


We pass "size" into ArrayList.
What if some "entity" is the null, hence not added, will the "list" size still be ok?
I would say you need to call "trimToSize"?

@Sanne: how would we get just key to be used / loaded, not full entity;
e.g GAE has Query::setKeysOnly 
... you mentioned some projections

-Ales




More information about the infinispan-dev mailing list