Results 1 to 3 of 3
  1. #1
    alpdog14 is offline Member
    Join Date
    Mar 2009
    Posts
    57
    Rep Power
    0

    Default Convert Map to Index

    So I have this Map

    Java Code:
    private static Map<String, List<Integer>> getS7Index() {
    		Map<String, List<Integer>> result = new TreeMap<String, List<Integer>>();
    		
    		result.put("worship", Arrays.asList(new Integer[] { 7 }));
    		result.put("sacrifice", Arrays.asList(new Integer[] { 7 }));
    		return result;
    	}
    And I need help converting it to a Index, I know I need to create the Index from the Map and return the Index but not sure how to do this, can anyone help me convert this to an Index type.

  2. #2
    doWhile is offline Moderator
    Join Date
    Jul 2010
    Location
    California
    Posts
    1,641
    Rep Power
    7

    Default

    I think you might have to define what you mean by 'index'...do you mean an integer, something like calling hashCode()?

  3. #3
    alpdog14 is offline Member
    Join Date
    Mar 2009
    Posts
    57
    Rep Power
    0

    Default

    So here is my Index class:

    Java Code:
    public interface Index extends Iterable<Map.Entry<String, List<Integer>>> {
    
    	void add(String word, int line);
    	boolean contains(String word);
    	int frequency(String word);
    	List<Integer> lines(String word);
    	void clear();
    	int size();
    }
    Does this help define Index?

Similar Threads

  1. Redirecting port 80 index to port 8080 index
    By chyrl in forum Advanced Java
    Replies: 0
    Last Post: 11-30-2010, 04:15 PM
  2. Replies: 0
    Last Post: 10-29-2010, 09:15 PM
  3. Changing the index
    By Drayfe in forum Lucene
    Replies: 0
    Last Post: 09-15-2010, 07:28 PM
  4. Index of an int
    By wake in forum New To Java
    Replies: 4
    Last Post: 02-24-2010, 02:54 PM
  5. I can't run my index.jsp
    By gissah in forum New To Java
    Replies: 0
    Last Post: 03-23-2009, 02:42 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •