Question: I have a custom object in a Map: below is the structure

```
Allocation {
double risk;
double[] weights;
double returnValue;
}

```

I have a Map of Allocation Objects such as:

```
Map<String, Allocation>

```

I would like to get the weights in a 2d array with Java 8. 

weights={{.3, .2, 0.5}, {0.4, 0.4,0.2}, {0.5, 0.25, 0.25},...}

The Allocation Map contains many Portfolio objects like below:

```
key: portfolio1, Object: (risk=0.03, weights={0.3,0.2,0.5}, returnvalue=0.5)
Key: portfolio2, Object: (risk=0.05, weights={0.4,0.4,0.2}, returnvalue=0.3)
Key: portfolio3, Object: (risk=0.01, weights={0.5, 0.25, 0.25}, return=0.6)

```

I would like to get an 2d array of weights:

```
weights[0] = {0.3,0.2,0.5}
weights[1] = {0.4,0.4,0.2}
weights[1] = {0.5, 0.25, 0.25} and so on...

```

Looking for the best way to do so
Thanks!

Answer: 
In current versions of React Native and PubNub (4.31+), the message may not be obtained correctly using the `getMessage` method, and therefore the 'message' appears as `undefined`.

So if anyone has this problem, just use the `addListener` instead of `getMessage`, following their respective documentation.

I have spent days trying to run the same code and I hope I can help someone else.
Based on this GitHub answer: <https://github.com/react-native-community/react-native-maps/issues/2195#issuecomment-424246731> it would be best to just use the `coordinate.timing(newCoordinate).start();` code. 

```
Invariant Violation: [37,"AIRMapMarker",481,{"coordinate":{"latitude":37.78825,"longitude":-122.4324,"latitudeDelta":"<<NaN>>","longitudeDelta":"<<NaN>>"},"position":"absolute","backgroundColor":0}]

```

This failure is being caused because the `newCoordinate` is missing the `latitudeDelta` and `longitudeDelta`, so the final code should look like this:

```
this.pubnub.getMessage('location', msg => {
      const { coordinate } = this.state;
      const { latitude, longitude } = msg.message;
      const newCoordinate = {
          latitude,
          longitude,
          latitudeDelta = LATITUDE_DELTA,
          longitudeDelta = LONGITUDE_DELTA
      };

      coordinate.timing(newCoordinate).start();

      this.setState({
        latitude,
        longitude,
      });
    });

```