Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6832187
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:49:41+00:00 2026-05-26T22:49:41+00:00

I’m in a data structures class and we have an assignment that includes creating

  • 0

I’m in a data structures class and we have an assignment that includes creating a hash table for a latin dictionary and on the getDefinition method in the LatinDictionary class (basically a wrapper) it asks for string back after an input of a string like so…

import java.util.Iterator;
import data_structures.*;

public class LatinDictionary {
private DictionaryADT<String,String> dictionary;
private int maxSize = DictionaryReader.entries.length;
....
public String getDefinition(String latinWord) {
    return dictionary.getValue(latinWord);
}

The getValue method is as follows:

package data_structures;
import java.util.Iterator;

public class HashTable <K,V> implements DictionaryADT<K,V>{

private int maxSize,currentSize,tableSize;
private UnorderedList<DictionaryNode<K,V>>[] list;
DictionaryADT<String, String> dictionary;
...
public V getValue(K key){
    int code = hashCode((String)key);
    DictionaryNode temp = new DictionaryNode(key,null);
    if(!list[code].contains(temp))return null;
    DictionaryNode temp2 = new DictionaryNode(null, list[code].find(temp));
    return (V) temp2.value;
}

and the find method from the unordered list class is as follows:

package data_structures;
import java.util.Iterator;
import java.util.NoSuchElementException;

public class UnorderedList<E> implements Iterable<E>{
public E find(E object) {
    Node<E> current=head;
    Node<E> previous = head;
    Node<E> temp=null;
    while(current!=null && ((Comparable<E>)object).compareTo((current.data))!=0){
        previous=current;
        current=current.next;
        temp=current;
        }

    return temp.data;
    }

The dictionaryADT is an interface provided and a specification is that the LatinDictionary will only reference the ADT object and not the hashtable itself.
Additionally, I cannot import java.util.*.
No matter what I try I keep getting a “cannot cast” error or something else depending on what I try but I can’t see how to get from a V to a string.
Unfortunately I can’t find ANYTHING on the internet relating to self-built hashtables let alone the sort of implementation I have to use here. Anything that has to do with hashtables uses the built-in version and not a self written one, which is of very little use. I have this project due in like 2 weeks but there are 3 other implementations to do after this one! Any help is greatly appreciated. Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T22:49:42+00:00Added an answer on May 26, 2026 at 10:49 pm

    I got it….instead of

    public V getValue(K key){
    .....
    DictionaryNode temp2 = new DictionaryNode(null, list[code].find(temp));
    

    it should be…

    public V getValue(K key){
    ....
    DictionaryNode temp2 = new DictionaryNode(null, list[code].find(temp).value);
    return (V) temp2.value;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have some data like this: 1 2 3 4 5 9 2 6
I am doing a simple coin flipping experiment for class that involves flipping a
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I have a jquery bug and I've been looking for hours now, I can't
this is what i have right now Drawing an RSS feed into the php,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.