Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

You have two lists of objects and the thing you want to compare against is a property nested two levels deep in one kind of object and one level deep in the other object. Are you sure you still want to pass this to a library and not write this simple and basic approach yourself?

1. Pick shorter list

2. Create hashmap comparable -> object

3. Iterate longer list and check for each item: comparable in hashmap?

Done.

That doesn't need a library. Sure, let's say in Java, you could maybe pass your custom implementation of comparable to the library, but is this seriously your interpretation of better code? In fact in many cases the library can't help you, because your structures are not as basic as the library would need them and transforming is a huge and unnecessary overhead.

That's the thing, you usually don't need (and want) to implement an algorithm on basic strings. But the kind of problem, where you need the same approach but don't have strings appear a lot. Especially if you enjoy to work in system infrastructure like I do.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: