cloudstack-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jburwell <...@git.apache.org>
Subject [GitHub] cloudstack pull request: Taking fast and efficient volume snapshot...
Date Mon, 11 Apr 2016 15:53:50 GMT
Github user jburwell commented on the pull request:

    https://github.com/apache/cloudstack/pull/1403#issuecomment-208417118
  
    @mike-tutkowski ``null`` values in a ``Map`` are extremely ugly.  It seems like filtering
them at the time a ``Map`` is created would make things simpler overall (i.e. no need to check
that every value retrieved is not ``null``.  Using Guava, you can filter a map cleanly as
follows:
    
    ```
        ImmutableMap<String, Object> copy = ImmutableMap.of(Maps.filterValues(map, new
Predicate<Object>() {
    
           apply(Object input) {
               return input != null;
           }
    
       }));
    ```
    
    This type of operation seems like it would be useful across CloudStack.  Therefore, I
would further suggest creating a utility method in utils (e.g. ``copyMapToImmutableMap``)
to wrap this operation and properly unit test it.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message