All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.github.mmm.base.metainfo.impl.MetaInfoPrefixedIterator Maven / Gradle / Ivy

/* Copyright (c) The m-m-m Team, Licensed under the Apache License, Version 2.0
 * http://www.apache.org/licenses/LICENSE-2.0 */
package io.github.mmm.base.metainfo.impl;

import java.util.Iterator;

import io.github.mmm.base.collection.AbstractIterator;

/**
 * Implementation of {@link Iterator} for {@link AbstractMetaInfo}.
 */
public class MetaInfoPrefixedIterator extends AbstractIterator {

  private final MetaInfoPrefixed metaInfo;

  private final Iterator iterator;

  /**
   * The constructor.
   *
   * @param metaInfo the {@link AbstractMetaInfo} to iterate.
   */
  public MetaInfoPrefixedIterator(MetaInfoPrefixed metaInfo) {

    super();
    this.metaInfo = metaInfo;
    this.iterator = metaInfo.parent.iterator();
    findFirst();
  }

  @Override
  protected String findNext() {

    while (this.iterator.hasNext()) {
      String key = this.metaInfo.unqualifyKey(this.iterator.next());
      if (key != null) {
        return key;
      }
    }
    return null;
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy