| 193 | auto& cache = JavaEnv::getCache(); |
| 194 | return JavaValue::makeObject(cache.getHashMapClass().newObject(cache.getHashMapConstructorMethod())); |
| 195 | } |
| 196 | |
| 197 | void JavaValueDelegate::setMapEntry(const JavaValue& map, |
| 198 | const JavaValue& key, |
| 199 | const JavaValue& value, |
| 200 | Valdi::ExceptionTracker& exceptionTracker) { |
| 201 | JavaEnv::getCache().getHashMapPutMethod().call( |
| 202 | javaValueToObject(map), javaValueToObject(key), javaValueToObject(value)); |
| 203 | } |
| 204 | |
| 205 | size_t JavaValueDelegate::getMapEstimatedLength(const JavaValue& map, Valdi::ExceptionTracker& exceptionTracker) { |
| 206 | auto size = JavaEnv::getCache().getMapSizeMethod().call(javaValueToObject(map)); |
| 207 | return static_cast<size_t>(size); |
| 208 | } |
| 209 | |
| 210 | void JavaValueDelegate::visitMapKeyValues(const JavaValue& map, |
| 211 | Valdi::PlatformMapValueVisitor<JavaValue>& visitor, |
| 212 | Valdi::ExceptionTracker& exceptionTracker) { |
| 213 | auto entrySet = JavaCache::get().getMapEntrySetMethod().call(map.getObject()); |
| 214 | auto iterator = JavaIterator::fromIterable(entrySet.getUnsafeObject()); |
| 215 | |
| 216 | for (;;) { |
| 217 | auto next = iterator.next(); |
| 218 | if (!next) { |
| 219 | break; |
no test coverage detected