0

I have a situation where I want to store a bitmap(Object), int value(speed of bitmap) and another index value to access these other 2. Any ideas? Was thinking in using HashMap however, hashmaps only deals with the Object and Index, but need another integer value that will be associated with that specific Object!

4

1 回答 1

0

看起来您需要位图和速度的专用类型。如果索引用于检索其他两个值,请将它们打包成一个类型:

class FlyingBitmap{
        private Bitmap bitmap;
        private double speed;
        ...
    }

并使用HashMap

Map<Integer, FlyingBitmap> map = new HashMap<Integer, FlyingBitmap>();
于 2012-11-16T15:46:28.820 回答