Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
cs2-23wi
lectures
Commits
6f67538d
Commit
6f67538d
authored
2 years ago
by
Adam Blank
Browse files
Options
Download
Email Patches
Plain Diff
Code after lecture04
parent
eb522d83
master
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
04/OurArrayList.java
+7
-20
04/OurArrayList.java
with
7 additions
and
20 deletions
+7
-20
04/OurArrayList.java
View file @
6f67538d
...
...
@@ -23,21 +23,6 @@ public class OurArrayList<E> implements IList<E> {
return
"["
+
elements
+
"]"
;
}
/**
* Puts element at index idx, shifting over everything after to the right.
* @param idx
* @param element
* For example, idx = 2, element = 42
* [1, 2, 3, 4, 5]
* ^
* [1, 2, 42, 3, 4, 5]
*/
public
void
add
(
int
idx
,
int
element
)
{
}
@Override
public
int
size
()
{
return
this
.
size
;
...
...
@@ -55,6 +40,7 @@ public class OurArrayList<E> implements IList<E> {
}
@Override
public
E
get
(
int
idx
)
{
return
null
;
}
...
...
@@ -64,6 +50,12 @@ public class OurArrayList<E> implements IList<E> {
this
.
size
=
0
;
}
@Override
public
void
add
(
int
idx
,
E
elem
)
{
}
@Override
public
void
add
(
E
elt
)
{
if
(
this
.
size
==
this
.
data
.
length
)
{
E
[]
newData
=
(
E
[])
new
Object
[
this
.
size
*
2
];
...
...
@@ -76,10 +68,5 @@ public class OurArrayList<E> implements IList<E> {
this
.
size
++;
}
@Override
public
void
add
(
int
idx
,
E
elem
)
{
}
}
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help