Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ More examples can be found [here](https://github.com/foodtiny/native/tree/master

### Contributors
- This library must be followed [Oracle Java 8 Documentation](https://docs.oracle.com/javase/8/docs/api) for standardization
- Make sure your commits must be passed before you create pull request
- Make sure your commits must be passed with [check](./check) before you create pull request
- At least one contributor in this project reviews your commits (except you) before merging
- Best practices guidelines in [CONTRIBUTION.md](https://github.com/foodtiny/native/tree/master/CONTRIBUTION.md)

Expand Down
31 changes: 16 additions & 15 deletions java/util/HashMap/HashMap.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,12 @@ namespace Java {

public:
/**
* Compares the specified object
* Compares the anotherHashMap
* with this map for equality.
*
* @param object
* @param anotherHashMap
* @return true if equal
* false if not equal
*/
boolean equals(const HashMap<Key, Value> &anotherHashMap) {

Expand All @@ -133,13 +135,13 @@ namespace Java {
*
* @param action
*/
void forEach(BiConsumer<void(Key, Value)> action) {
for (auto &element : this->original) {
Key key = element.first;
Value value = element.second;
action(key, value);
}
}
// void forEach(BiConsumer<void(Key, Value)> action) {
// for (auto &element : this->original) {
// Key key = element.first;
// Value value = element.second;
// action(key, value);
// }
// }

// TODO(thoangminh): We will support this method later
/**
Expand All @@ -151,10 +153,10 @@ namespace Java {
* Object.
*
* This implementation iterates over entrySet(), calling
* {Map.Entry hashCode()} on each element (entry) in the
* Map.Entry hashCode() on each element (entry) in the
* set, and adding up the results.
*
* @return the hash code value for this map
* @return int the hash code value for this map
*/
int hashCode();

Expand Down Expand Up @@ -415,8 +417,7 @@ namespace Java {
/**
* Set of hash map entries
*
* Returns a Set view of the mappings contained in this map.
* @return Set<Map.Entry<Key,Value>> - a set view of the mappings contained in this map
* @return a set view of the mappings contained in this map
*/
Set<class Map<Key, Value>::Entry> entrySet() {
Set<class Map<Key, Value>::Entry> entrySet;
Expand All @@ -431,12 +432,12 @@ namespace Java {

/**
* Returns the value to which the specified key is mapped,
* or null if this map contains no mapping for the key
* or default if this map contains no mapping for the key
*
* @param key the key whose associated value is to be returned
*
* @return Value value the value to which the specified key is mapped,
* or null if no mapping with key
* or default if no mapping with key
*/
Value get(const Key &key) const {
Value result;
Expand Down
4 changes: 3 additions & 1 deletion java/util/HashMap/HashMapTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,9 @@ TEST (JavaUtil, HashMapContainsValue) {
TEST (JavaUtil, HashMapEntrySet) {
HashMap<String, String> hashMap;

for (int index = 1; index <= 100; index++) {
int index = 1;

for (index; index <= 100; index++) {
hashMap.put("Key " + String::valueOf(index),
"Value " + String::valueOf(index));
}
Expand Down
2 changes: 1 addition & 1 deletion kernel/Test.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,7 @@ void assertEqualsString(String expected,
const_string file,
int line) {
if (expected != actual) {
CTEST_ERR("%s:%d\nEXPECTED\n'%'\nACTUAL \n'%s'\n",
CTEST_ERR("%s:%d\nEXPECTED\n'%s'\nACTUAL \n'%s'\n",
file, line, expected.toString(), actual.toString());
}
}
Expand Down
1 change: 0 additions & 1 deletion kernel/Type.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@

#define NOT_FOUND -1
#define MAX_STRING_LENGTH 100000
#define BiConsumer std::function

#ifdef WIN
#define boolean bool
Expand Down
Binary file removed native_test.exe
Binary file not shown.