Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个包含文件列表的目录。我想从所述目录的所有内容中获取最新文件。我将如何做到这一点?
我正在使用此代码,但我没有从中获取最新文件。请帮忙。
def fileDir = new File("A/B").listFiles().first()
谢谢。
很简单:
new File( 'A/B' ).listFiles()?.sort { -it.lastModified() }?.head()
(取否定的 lastModified,因为我们首先要最新的文件)
I have a List of objects and each object is a another List of objects, so for example, I am passing List<object> cars to one method and I want to get all the properties of on
List<object> cars