Skip to content

Commit f949223

Browse files
committed
commit branch change
1 parent 865b857 commit f949223

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+58
-5
lines changed

.idea/.gitignore

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules.xml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/vcs.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

JavaApplication5.iml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<module type="JAVA_MODULE" version="4">
3+
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_17" inherit-compiler-output="true">
4+
<exclude-output />
5+
<content url="file://$MODULE_DIR$">
6+
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
7+
</content>
8+
<orderEntry type="jdk" jdkName="17" jdkType="JavaSDK" />
9+
<orderEntry type="sourceFolder" forTests="false" />
10+
</component>
11+
</module>

nbproject/private/private.xml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
33
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
44
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
5-
<group>
6-
<file>file:/C:/Users/nisab/Desktop/Java/JavaApplication5/src/Trees/AVL.java</file>
7-
<file>file:/C:/Users/nisab/Desktop/Java/JavaApplication5/src/Trees/Main.java</file>
8-
</group>
5+
<group/>
96
</open-files>
107
</project-private>
Binary file not shown.
Binary file not shown.
Binary file not shown.
858 Bytes
Binary file not shown.
502 Bytes
Binary file not shown.
4.08 KB
Binary file not shown.
Binary file not shown.
Binary file not shown.
941 Bytes
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
1.59 KB
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
2.23 KB
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
989 Bytes
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
946 Bytes
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
669 Bytes
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
875 Bytes
Binary file not shown.
Binary file not shown.
Binary file not shown.
776 Bytes
Binary file not shown.
Binary file not shown.
2.42 KB
Binary file not shown.

src/Lists/ArrayListCustom.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package Lists;
22

33
import java.util.*;
4+
import java.util.function.Consumer;
45

56
public class ArrayListCustom<T> implements Cloneable {
67

@@ -111,6 +112,13 @@ public String toString() {
111112
return builder.append("]").toString();
112113
}
113114

115+
public void forEach(Consumer<T> o) {
116+
Objects.requireNonNull(o);
117+
for (int i = 0; i < size; i++) {
118+
o.accept((T) arr[i]);
119+
}
120+
}
121+
114122
public Object[] toArray() {
115123
Object[] ret = new Object[size];
116124
for (int i = 0; i < size; i++) {

src/Maps/HashMapCustom.java

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
//check out my medium blog for hashmap
33
//https://medium.com/@nisabmohd/hashmap-in-java-c010dec8fbd0
44

5+
import java.util.Objects;
6+
import java.util.function.BiConsumer;
7+
58
public class HashMapCustom<K, V> {
69

710
private final int DEFAULT_CAPACITY = 17;
@@ -120,6 +123,17 @@ public void clear() {
120123
}
121124
}
122125

126+
public void forEach(BiConsumer<K, V> o) {
127+
Objects.requireNonNull(o);
128+
for (int i = 0; i < bucket.length; i++) {
129+
Entry temp = bucket[i];
130+
while (temp != null) {
131+
o.accept((K) temp.key, (V) temp.val);
132+
temp = temp.next;
133+
}
134+
}
135+
}
136+
123137
@Override
124138
public String toString() {
125139
StringBuilder builder = new StringBuilder("{");
@@ -130,7 +144,7 @@ public String toString() {
130144
temp = temp.next;
131145
}
132146
}
133-
if(builder.length()==1) builder.append(" ");
147+
if (builder.length() == 1) builder.append(" ");
134148
String t = builder.substring(0, builder.length() - 1);
135149
return (new StringBuilder(t)).append("}").toString();
136150
}

0 commit comments

Comments
 (0)