注册一亩三分地论坛,查看更多干货!
您需要 登录 才可以下载或查看附件。没有帐号?注册账号
x
zillow的offline assignment。
We have a Home class: class Home{ String street; String unit; String city; String state; Integer zip; Date dateLastRented; Double price; } And we are building a webpage that can list Homes sorted byany of the fields. Sample request: /homes?sortField=dateLastRented&ascending=false Without importing any libraries other than theJava Class Library or writing your own sortingalgorithm, please implement this method to sort the results: static List<Home> sort(Iterable<Home> homes,String sortField, boolean ascending){ } There are many ways to do it, so please briefly outline afew of the trade-offs you considered. We're mainly looking formaintainable code that your co-workers will find easy to read. lz用的java.reflection来找到相应属性然后做排序,挂掉,如果谁有好的解决方案列出来讨论一下。 . 1point3acres
|