HW3: Fixed heresy
This commit is contained in:
parent
601abefbcf
commit
2dda0a2bff
2 changed files with 72 additions and 86 deletions
|
@ -2,8 +2,9 @@
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="cf07aeb8-47a7-429b-9024-1f8bf10e85cc" name="Default Changelist" comment="">
|
<list default="true" id="cf07aeb8-47a7-429b-9024-1f8bf10e85cc" name="Default Changelist" comment="">
|
||||||
<change afterPath="$PROJECT_DIR$/ex3_test.txt" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/../hw2/Ex2/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/../hw2/Ex2/.idea/workspace.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/../hw2/Ex2/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/../hw2/Ex2/.idea/workspace.xml" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/streams/FileLinesProcessor.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/streams/FileLinesProcessor.java" afterDir="false" />
|
||||||
</list>
|
</list>
|
||||||
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
|
@ -16,14 +17,11 @@
|
||||||
</component>
|
</component>
|
||||||
<component name="FileEditorManager">
|
<component name="FileEditorManager">
|
||||||
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
|
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
|
||||||
<file pinned="false" current-in-tab="true">
|
<file pinned="false" current-in-tab="false">
|
||||||
<entry file="file://$PROJECT_DIR$/submission.tex">
|
<entry file="file://$PROJECT_DIR$/submission.tex">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="367">
|
<state relative-caret-position="795">
|
||||||
<caret line="53" column="25" selection-start-line="53" selection-start-column="25" selection-end-line="53" selection-end-column="25" />
|
<caret line="53" column="25" selection-start-line="53" selection-start-column="25" selection-end-line="53" selection-end-column="25" />
|
||||||
<folding>
|
|
||||||
<element signature="e#39#66#2" expanded="true" />
|
|
||||||
</folding>
|
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
|
@ -31,8 +29,8 @@
|
||||||
<file pinned="false" current-in-tab="false">
|
<file pinned="false" current-in-tab="false">
|
||||||
<entry file="file://$PROJECT_DIR$/src/fp/IntOperatorsUtil.java">
|
<entry file="file://$PROJECT_DIR$/src/fp/IntOperatorsUtil.java">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="165">
|
<state relative-caret-position="285">
|
||||||
<caret line="12" column="5" selection-start-line="12" selection-start-column="5" selection-end-line="12" selection-end-column="5" />
|
<caret line="22" column="48" selection-start-line="22" selection-start-column="48" selection-end-line="22" selection-end-column="48" />
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
|
@ -50,11 +48,11 @@
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
</file>
|
</file>
|
||||||
<file pinned="false" current-in-tab="false">
|
<file pinned="false" current-in-tab="true">
|
||||||
<entry file="file://$PROJECT_DIR$/src/streams/FileLinesProcessor.java">
|
<entry file="file://$PROJECT_DIR$/src/streams/FileLinesProcessor.java">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="280">
|
<state relative-caret-position="333">
|
||||||
<caret line="99" column="22" selection-start-line="99" selection-start-column="22" selection-end-line="99" selection-end-column="22" />
|
<caret line="72" column="71" lean-forward="true" selection-start-line="72" selection-start-column="71" selection-end-line="72" selection-end-column="71" />
|
||||||
<folding>
|
<folding>
|
||||||
<element signature="imports" expanded="true" />
|
<element signature="imports" expanded="true" />
|
||||||
</folding>
|
</folding>
|
||||||
|
@ -95,8 +93,8 @@
|
||||||
<option value="$PROJECT_DIR$/src/fp/IntOperatorsUtil.java" />
|
<option value="$PROJECT_DIR$/src/fp/IntOperatorsUtil.java" />
|
||||||
<option value="$PROJECT_DIR$/src/fp/FunctionsUtil.java" />
|
<option value="$PROJECT_DIR$/src/fp/FunctionsUtil.java" />
|
||||||
<option value="$PROJECT_DIR$/ex3_test.txt" />
|
<option value="$PROJECT_DIR$/ex3_test.txt" />
|
||||||
<option value="$PROJECT_DIR$/src/streams/FileLinesProcessor.java" />
|
|
||||||
<option value="$PROJECT_DIR$/submission.tex" />
|
<option value="$PROJECT_DIR$/submission.tex" />
|
||||||
|
<option value="$PROJECT_DIR$/src/streams/FileLinesProcessor.java" />
|
||||||
</list>
|
</list>
|
||||||
</option>
|
</option>
|
||||||
</component>
|
</component>
|
||||||
|
@ -154,6 +152,7 @@
|
||||||
</component>
|
</component>
|
||||||
<component name="PropertiesComponent">
|
<component name="PropertiesComponent">
|
||||||
<property name="ASKED_SHARE_PROJECT_CONFIGURATION_FILES" value="true" />
|
<property name="ASKED_SHARE_PROJECT_CONFIGURATION_FILES" value="true" />
|
||||||
|
<property name="SHARE_PROJECT_CONFIGURATION_FILES" value="true" />
|
||||||
<property name="WebServerToolWindowFactoryState" value="false" />
|
<property name="WebServerToolWindowFactoryState" value="false" />
|
||||||
<property name="aspect.path.notification.shown" value="true" />
|
<property name="aspect.path.notification.shown" value="true" />
|
||||||
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
|
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
|
||||||
|
@ -175,7 +174,7 @@
|
||||||
</list>
|
</list>
|
||||||
</option>
|
</option>
|
||||||
</component>
|
</component>
|
||||||
<component name="RunManager" selected="LaTeX.submission">
|
<component name="RunManager" selected="Application.IntOperatorsUtil">
|
||||||
<configuration name="FileLinesProcessor" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
|
<configuration name="FileLinesProcessor" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
|
||||||
<option name="MAIN_CLASS_NAME" value="streams.FileLinesProcessor" />
|
<option name="MAIN_CLASS_NAME" value="streams.FileLinesProcessor" />
|
||||||
<module name="hw3" />
|
<module name="hw3" />
|
||||||
|
@ -222,7 +221,7 @@
|
||||||
<compiler-path />
|
<compiler-path />
|
||||||
<compiler-arguments />
|
<compiler-arguments />
|
||||||
<main-file>$PROJECT_DIR$/submission.tex</main-file>
|
<main-file>$PROJECT_DIR$/submission.tex</main-file>
|
||||||
<aux-dir />
|
<aux-dir>$APPLICATION_HOME_DIR$/bin</aux-dir>
|
||||||
</texify-bibtex>
|
</texify-bibtex>
|
||||||
<method v="2" />
|
<method v="2" />
|
||||||
</configuration>
|
</configuration>
|
||||||
|
@ -266,9 +265,9 @@
|
||||||
</list>
|
</list>
|
||||||
<recent_temporary>
|
<recent_temporary>
|
||||||
<list>
|
<list>
|
||||||
|
<item itemvalue="Application.IntOperatorsUtil" />
|
||||||
<item itemvalue="Application.FileLinesProcessor" />
|
<item itemvalue="Application.FileLinesProcessor" />
|
||||||
<item itemvalue="Application.FunctionsUtil" />
|
<item itemvalue="Application.FunctionsUtil" />
|
||||||
<item itemvalue="Application.IntOperatorsUtil" />
|
|
||||||
<item itemvalue="LaTeX.submission (1)" />
|
<item itemvalue="LaTeX.submission (1)" />
|
||||||
</list>
|
</list>
|
||||||
</recent_temporary>
|
</recent_temporary>
|
||||||
|
@ -285,18 +284,22 @@
|
||||||
<updated>1575886303360</updated>
|
<updated>1575886303360</updated>
|
||||||
<workItem from="1575886304499" duration="94000" />
|
<workItem from="1575886304499" duration="94000" />
|
||||||
<workItem from="1575886414622" duration="3616000" />
|
<workItem from="1575886414622" duration="3616000" />
|
||||||
<workItem from="1575903832348" duration="10727000" />
|
<workItem from="1575903832348" duration="11015000" />
|
||||||
|
<workItem from="1575967348523" duration="1386000" />
|
||||||
|
<workItem from="1576140010540" duration="28000" />
|
||||||
|
<workItem from="1576528996442" duration="1593000" />
|
||||||
|
<workItem from="1576569898500" duration="909000" />
|
||||||
</task>
|
</task>
|
||||||
<servers />
|
<servers />
|
||||||
</component>
|
</component>
|
||||||
<component name="TimeTrackingManager">
|
<component name="TimeTrackingManager">
|
||||||
<option name="totallyTimeSpent" value="14437000" />
|
<option name="totallyTimeSpent" value="18641000" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ToolWindowManager">
|
<component name="ToolWindowManager">
|
||||||
<frame x="0" y="0" width="1015" height="1050" extended-state="0" />
|
<frame x="0" y="0" width="1920" height="1200" extended-state="0" />
|
||||||
<editor active="true" />
|
<editor active="true" />
|
||||||
<layout>
|
<layout>
|
||||||
<window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.43062693" />
|
<window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.25612354" />
|
||||||
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
|
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
|
||||||
<window_info id="Designer" order="2" />
|
<window_info id="Designer" order="2" />
|
||||||
<window_info id="Image Layers" order="3" />
|
<window_info id="Image Layers" order="3" />
|
||||||
|
@ -306,7 +309,7 @@
|
||||||
<window_info id="Favorites" order="7" side_tool="true" />
|
<window_info id="Favorites" order="7" side_tool="true" />
|
||||||
<window_info anchor="bottom" id="Message" order="0" />
|
<window_info anchor="bottom" id="Message" order="0" />
|
||||||
<window_info anchor="bottom" id="Find" order="1" />
|
<window_info anchor="bottom" id="Find" order="1" />
|
||||||
<window_info anchor="bottom" id="Run" order="2" visible="true" weight="0.32959184" />
|
<window_info anchor="bottom" id="Run" order="2" weight="0.32959184" />
|
||||||
<window_info anchor="bottom" id="Debug" order="3" weight="0.4" />
|
<window_info anchor="bottom" id="Debug" order="3" weight="0.4" />
|
||||||
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
|
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
|
||||||
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
|
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
|
||||||
|
@ -332,20 +335,6 @@
|
||||||
<option name="version" value="1" />
|
<option name="version" value="1" />
|
||||||
</component>
|
</component>
|
||||||
<component name="editorHistoryManager">
|
<component name="editorHistoryManager">
|
||||||
<entry file="jar:///Library/Java/JavaVirtualMachines/openjdk-12.0.1.jdk/Contents/Home/lib/src.zip!/java.base/java/util/stream/Collectors.java">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="318">
|
|
||||||
<caret line="317" column="28" selection-start-line="317" selection-start-column="28" selection-end-line="317" selection-end-column="28" />
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
<entry file="file://$PROJECT_DIR$/ex3_test.txt">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="60">
|
|
||||||
<caret line="4" selection-start-line="4" selection-end-line="4" />
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
<entry file="jar:///Library/Java/JavaVirtualMachines/openjdk-12.0.1.jdk/Contents/Home/lib/src.zip!/java.base/java/util/Collection.java">
|
<entry file="jar:///Library/Java/JavaVirtualMachines/openjdk-12.0.1.jdk/Contents/Home/lib/src.zip!/java.base/java/util/Collection.java">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="2">
|
<state relative-caret-position="2">
|
||||||
|
@ -364,18 +353,18 @@
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
<entry file="file://$PROJECT_DIR$/src/Cose.java">
|
<entry file="file://$PROJECT_DIR$/src/Cose.java" />
|
||||||
|
<entry file="file://$PROJECT_DIR$/submission.tex">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="315">
|
<state relative-caret-position="795">
|
||||||
<caret line="21" lean-forward="true" selection-start-line="21" selection-end-line="21" />
|
<caret line="53" column="25" selection-start-line="53" selection-start-column="25" selection-end-line="53" selection-end-column="25" />
|
||||||
<folding>
|
</state>
|
||||||
<element signature="e#292#293#0" expanded="true" />
|
</provider>
|
||||||
<element signature="e#347#348#0" expanded="true" />
|
</entry>
|
||||||
<element signature="e#395#396#0" expanded="true" />
|
<entry file="file://$PROJECT_DIR$/src/fp/IntOperatorsUtil.java">
|
||||||
<element signature="e#490#491#0" expanded="true" />
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<element signature="e#521#522#0" expanded="true" />
|
<state relative-caret-position="285">
|
||||||
<element signature="e#607#608#0" expanded="true" />
|
<caret line="22" column="48" selection-start-line="22" selection-start-column="48" selection-end-line="22" selection-end-column="48" />
|
||||||
</folding>
|
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
|
@ -390,33 +379,30 @@
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/ex3_test.txt">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="60">
|
||||||
|
<caret line="4" selection-start-line="4" selection-end-line="4" />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="jar:///Library/Java/JavaVirtualMachines/openjdk-12.0.1.jdk/Contents/Home/lib/src.zip!/java.base/java/util/stream/Collectors.java">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="368">
|
||||||
|
<caret line="1067" column="31" selection-start-line="1067" selection-start-column="31" selection-end-line="1067" selection-end-column="31" />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
<entry file="file://$PROJECT_DIR$/src/streams/FileLinesProcessor.java">
|
<entry file="file://$PROJECT_DIR$/src/streams/FileLinesProcessor.java">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="280">
|
<state relative-caret-position="333">
|
||||||
<caret line="99" column="22" selection-start-line="99" selection-start-column="22" selection-end-line="99" selection-end-column="22" />
|
<caret line="72" column="71" lean-forward="true" selection-start-line="72" selection-start-column="71" selection-end-line="72" selection-end-column="71" />
|
||||||
<folding>
|
<folding>
|
||||||
<element signature="imports" expanded="true" />
|
<element signature="imports" expanded="true" />
|
||||||
</folding>
|
</folding>
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
<entry file="file://$PROJECT_DIR$/src/fp/IntOperatorsUtil.java">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="165">
|
|
||||||
<caret line="12" column="5" selection-start-line="12" selection-start-column="5" selection-end-line="12" selection-end-column="5" />
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
<entry file="file://$PROJECT_DIR$/submission.tex">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="367">
|
|
||||||
<caret line="53" column="25" selection-start-line="53" selection-start-column="25" selection-end-line="53" selection-end-column="25" />
|
|
||||||
<folding>
|
|
||||||
<element signature="e#39#66#2" expanded="true" />
|
|
||||||
</folding>
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
</component>
|
</component>
|
||||||
<component name="masterDetails">
|
<component name="masterDetails">
|
||||||
<states>
|
<states>
|
||||||
|
@ -473,7 +459,6 @@
|
||||||
<option name="proportions">
|
<option name="proportions">
|
||||||
<list>
|
<list>
|
||||||
<option value="0.2" />
|
<option value="0.2" />
|
||||||
<option value="0.6" />
|
|
||||||
</list>
|
</list>
|
||||||
</option>
|
</option>
|
||||||
</splitter-proportions>
|
</splitter-proportions>
|
||||||
|
|
|
@ -46,40 +46,41 @@ public class FileLinesProcessor {
|
||||||
|
|
||||||
public Map<Character, Long> countCharsOccurrences() throws IOException {
|
public Map<Character, Long> countCharsOccurrences() throws IOException {
|
||||||
return getLines()
|
return getLines()
|
||||||
.map(String::chars)
|
.flatMapToInt(String::chars)
|
||||||
.reduce(IntStream.of(), IntStream::concat)
|
|
||||||
.boxed()
|
.boxed()
|
||||||
.collect(Collectors.groupingBy(i -> (char) (i & 0xFFFF), Collectors.counting()));
|
.collect(Collectors.groupingBy(i -> (char) i.intValue(), Collectors.counting()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<Character, Long> countCharsOccurrences(int n) throws IOException {
|
public Map<Character, Long> countCharsOccurrences(int n) throws IOException {
|
||||||
return getLines()
|
return countCharsOccurrences()
|
||||||
.map(String::chars)
|
|
||||||
.reduce(IntStream.of(), IntStream::concat)
|
|
||||||
.boxed()
|
|
||||||
.collect(Collectors.groupingBy(i -> (char) (i & 0xFFFF), Collectors.counting()))
|
|
||||||
.entrySet()
|
.entrySet()
|
||||||
.stream()
|
.stream()
|
||||||
.filter(e -> e.getValue() > n)
|
.filter(e -> e.getValue() > n)
|
||||||
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
|
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static <T> void assertEquals(T o1, T o2) {
|
||||||
|
if (o1 != o2 && o2 == null || !o2.equals(o1)) {
|
||||||
|
throw new AssertionError(o1 + " != " + o2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static void main(final String... args) throws IOException {
|
public static void main(final String... args) throws IOException {
|
||||||
final FileLinesProcessor processor = new FileLinesProcessor("ex3_test.txt");
|
final FileLinesProcessor processor = new FileLinesProcessor("ex3_test.txt");
|
||||||
assert processor.fileLinesAsBytes()[0][1] == 'b';
|
assertEquals(processor.fileLinesAsBytes()[0][1], (byte) 'b');
|
||||||
assert processor.fileLinesAsBytes()[1][2] == 'z';
|
assertEquals(processor.fileLinesAsBytes()[1][2], (byte) 'z');
|
||||||
assert processor.countByNumberOfSpaces(0) == 2; // (i.e., "abc" and "xyz")
|
assertEquals(processor.countByNumberOfSpaces(0), 2L); // (i.e., "abc" and "xyz")
|
||||||
assert processor.countByNumberOfSpaces(2) == 1; // (i.e., "play with streams")
|
assertEquals(processor.countByNumberOfSpaces(2), 1L); // (i.e., "play with streams")
|
||||||
assert "axhp".equals(processor.concatNth(0));
|
assertEquals(processor.concatNth(0), "axhp");
|
||||||
assert "byel".equals(processor.concatNth(1));
|
assertEquals(processor.concatNth(1), "byel");
|
||||||
assert "ly".equals(processor.concatNth(3));
|
assertEquals(processor.concatNth(3), "ly");
|
||||||
|
|
||||||
final Map<Integer, List<String>> expected = new HashMap<>();
|
final Map<Integer, List<String>> expected = new HashMap<>();
|
||||||
expected.put(3, Arrays.asList("abc", "xyz"));
|
expected.put(3, Arrays.asList("abc", "xyz"));
|
||||||
expected.put(11, Collections.singletonList("hello world"));
|
expected.put(11, Collections.singletonList("hello world"));
|
||||||
expected.put(17, Collections.singletonList("play with streams"));
|
expected.put(17, Collections.singletonList("play with streams"));
|
||||||
assert expected.equals(processor.groupByLineLength()); // Expected result: {3=[abc, xyz], 11=[hello world],
|
assertEquals(processor.groupByLineLength(), expected); // Expected result: {3=[abc, xyz], 11=[hello world],
|
||||||
// 17=[play with streams]}
|
// 17=[play with streams]}
|
||||||
|
|
||||||
final Map<Character, Long> expected2 = new HashMap<>();
|
final Map<Character, Long> expected2 = new HashMap<>();
|
||||||
expected2.put(' ', 3L);
|
expected2.put(' ', 3L);
|
||||||
|
@ -101,14 +102,14 @@ public class FileLinesProcessor {
|
||||||
expected2.put('x', 1L);
|
expected2.put('x', 1L);
|
||||||
expected2.put('y', 2L);
|
expected2.put('y', 2L);
|
||||||
expected2.put('z', 1L);
|
expected2.put('z', 1L);
|
||||||
assert expected2.equals(processor.countCharsOccurrences()); // Expected result { =3, a=3, b=1, c=1, d=1, e=2,
|
assertEquals(processor.countCharsOccurrences(), expected2); // Expected result { =3, a=3, b=1, c=1, d=1, e=2,
|
||||||
// h=2, i=1, l=4, m=1, o=2, p=1, r=2, s=2, t=2, w=2,
|
// h=2, i=1, l=4, m=1, o=2, p=1, r=2, s=2, t=2, w=2,
|
||||||
// x=1, y=2, z=1}
|
// x=1, y=2, z=1}
|
||||||
final Map<Character, Long> expected3 = new HashMap<>();
|
final Map<Character, Long> expected3 = new HashMap<>();
|
||||||
expected3.put(' ', 3L);
|
expected3.put(' ', 3L);
|
||||||
expected3.put('a', 3L);
|
expected3.put('a', 3L);
|
||||||
expected3.put('l', 4L);
|
expected3.put('l', 4L);
|
||||||
assert expected3.equals(processor.countCharsOccurrences(2)); // Expected result: { =3, a=3, l=4}
|
assertEquals(processor.countCharsOccurrences(2), expected3); // Expected result: { =3, a=3, l=4}
|
||||||
|
|
||||||
System.out.println("OK");
|
System.out.println("OK");
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue