alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Lucene example source code file (TermFreqIterator.java)

This example Lucene source code file (TermFreqIterator.java) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Lucene tags/keywords

iterator, iterator, string, termfreqiterator, termfreqiterator, termfreqiteratorwrapper, termfreqiteratorwrapper, unsupportedoperationexception, unsupportedoperationexception, util

The Lucene TermFreqIterator.java source code

package org.apache.lucene.search.spell;

import java.util.Iterator;

public interface TermFreqIterator extends Iterator<String> {

  public float freq();
  
  public static class TermFreqIteratorWrapper implements TermFreqIterator {
    private Iterator<String> wrapped;
    
    public TermFreqIteratorWrapper(Iterator<String> wrapped) {
      this.wrapped = wrapped;
    }

    public float freq() {
      return 1.0f;
    }

    public boolean hasNext() {
      return wrapped.hasNext();
    }

    public String next() {
      return wrapped.next().toString();
    }

    public void remove() {
      throw new UnsupportedOperationException();
    }
    
  }
}

Other Lucene examples (source code examples)

Here is a short list of links related to this Lucene TermFreqIterator.java source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.