/** * Construct with list of keypoints * @param kpl */ public KeypointListArrayIterator(LocalFeatureList<? extends Keypoint> kpl) { this.kpli = kpl.iterator(); }
@SuppressWarnings("unchecked") @Override public void writeBinary(DataOutput out) throws IOException { if (keyClass == null) { if (!this.keySet().iterator().hasNext()) { throw new IOException("unable to guess type"); } keyClass = (Class<K>) this.keySet().iterator().next().getClass(); } if (valueClass == null) { if (!this.values().iterator().hasNext()) { throw new IOException("unable to guess type"); } if (!this.values().iterator().next().iterator().hasNext()) { throw new IOException("unable to guess type"); } valueClass = (Class<V>) this.values().iterator().next().iterator().next().getClass(); } out.writeUTF(keyClass.getCanonicalName()); out.writeUTF(valueClass.getCanonicalName()); out.writeInt(this.size()); for (final Entry<K, LocalFeatureList<V>> e : this.entrySet()) { e.getKey().writeBinary(out); e.getValue().writeBinary(out); } }
@SuppressWarnings("unchecked") @Override public void writeBinary(DataOutput out) throws IOException { if (keyClass == null) { if (!this.keySet().iterator().hasNext()) { throw new IOException("unable to guess type"); } keyClass = (Class<K>) this.keySet().iterator().next().getClass(); } if (valueClass == null) { if (!this.values().iterator().hasNext()) { throw new IOException("unable to guess type"); } if (!this.values().iterator().next().iterator().hasNext()) { throw new IOException("unable to guess type"); } valueClass = (Class<V>) this.values().iterator().next().iterator().next().getClass(); } out.writeUTF(keyClass.getCanonicalName()); out.writeUTF(valueClass.getCanonicalName()); out.writeInt(this.size()); for (final Entry<K, LocalFeatureList<V>> e : this.entrySet()) { e.getKey().writeBinary(out); e.getValue().writeBinary(out); } }