![]() ![]() Somewhere I read that because of Java using a virtual machine it makes the processing of data much slower. this clean the map so it doesnt run out of memory main loop that will cheek each word in the 500k fileįileWriter fw = new FileWriter("C:\\Users\\filePath", true) ![]() while loop that add the words to a list so it can manipulate it latter on Scanner s = new Scanner(new File("C:\\Users\\filepath")) scans the file that contains the 500k unrepeted words List that contains the current file words List that contain arround 500k unrepeted words int that will count how manny times the word is in the File set 2 This is the map that will contain each word I am using Java 8, with IntelliJ as my IDE. I am still learning Java so my knowledge is not that vast. Is it possible to make it more process efficient? The main problem I have is that it's taking around 4 seconds per word to process so it will take around 24 days to complete all 500k words in a core5 7th gen 8gb ram laptop. The program counts how many times each word from the first file appears in the second set of files. So if the tests expect your class to have a constructor which takes arguments, then you need to create this constructor yourself.My program works with two types of files.įile set 2 contains 173 text files, each containing 500 paragraphs, that I scraped from Wikipedia. This default constructor takes no arguments. If you don't add a constructor, Java will add a default one for you. ![]() This error means that you need to add a constructor to your new class. Reason: actual and formal argument lists differ in length You might get an error similar to: constructor ExerciseClassName in class ExerciseClassName cannot be applied to given types ĮxerciseClassName exerciseClassName = new ExerciseClassName("some argument") When you try to run the tests again you will get slightly different errors. To resolve the error you need to add a file matching the class name in the error to the src/main/java directory.įor example, for the error above you would add a file called ExerciseClassName.java. This error occurs because the test refers to a class that hasn't been created yet ( ExerciseClassName). They will give you an error similar to: path-to-exercism-dir\exercism\java\name-of-exercise\src\test\java\ExerciseClassNameTest.java:14: error: cannot find symbolĮxerciseClassName exerciseClassName = new ExerciseClassName() It does mean that when you first try to run the tests, they won't compile. This is so that you get to practice creating classes and methods which is an important part of programming in Java. Since this exercise has difficulty 5 it doesn't come with any starter implementation. The words can be separated by any form of whitespace (ie "\t", "\n", " ")įor example, for the phrase "That's the password: 'PASSWORD 123'!", cried the Special Agent.\nSo I fled.Other than the apostrophe in a contraction all forms of punctuation are ignored.The count is unordered the tests will ignore how words and counts are ordered.The count is case insensitive (ie "You", "you", and "YOU" are 3 uses of the same word).When counting words you can assume the following rules: A contraction of two simple words joined by a single apostrophe (ie "it's" or "they're").A simple word composed of one or more ASCII letters (ie "a" or "they") OR. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |