java 番石榴库和 GWT

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2005687/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-29 18:53:27  来源:igfitidea点击:

Guava libraries and GWT

javagwtguava

提问by jldupont

Just discovered the Guava librariesproject.

刚刚发现了番石榴库项目。

Do these work with GWT?

这些对 GWT 有用吗?

采纳答案by Ben James

From the introductory PDF on that page,

从该页面的介绍性 PDF 中,

You can use these libraries on...

  • On JDK 6
  • On Android
    We think. Need volunteers to help us test it out.
  • On Google App Engine
    We think. Need volunteers to help us test it out.
  • On GWT -- spotty!
    Because GWT's JDK library support is spotty
    Maybe 2/3 the stuff in these libraries is GWT-safe so far
    Just look for @GwtCompatible!
    Performance? Not necessarily good.

您可以在...上使用这些库

  • 在 JDK 6 上
  • 在 Android
    我们认为。需要志愿者帮助我们进行测试。
  • 关于 Google App Engine
    我们认为。需要志愿者帮助我们进行测试。
  • 在 GWT 上——参差不齐!
    因为 GWT 的 JDK 库支持参差不齐
    ,到目前为止,这些库中的内容可能是 GWT 安全的 2/3
    只需寻找@GwtCompatible
    表现?不一定好。

回答by Hbf

Here are some more details on how to accomplish this with the (currently latest) 19.0release of Guava.

以下是有关如何使用(当前最新的)19.0Guava 版本完成此操作的更多详细信息。

  1. The Guava release consists of two JARs, guava-19.0.jarand guava-gwt-19.0.jar. You will need bothfor getting Guava to work within your GWT project. (In a non-GWT project you will only need the former.) Download them and add them to your project; if you use Maven, use these dependencies:

    <dependency>
        <groupId>com.google.guava</groupId>
        <artifactId>guava</artifactId>
        <version>19.0</version>
    </dependency>
    <dependency>
        <groupId>com.google.guava</groupId>
        <artifactId>guava-gwt</artifactId>
        <version>19.0</version>
    </dependency>
    

    Maven will then automatically download the two Jars from the Central Maven Repository, see also the Guava page on mvnrepositories. As an SBT user, you would go for something like libraryDependencies += "com.google.guava" % "guava" % "19.0".

  2. Add

      <inherits name="com.google.common.collect.Collect"/>
    

    to your GWT module file to enable Guava.

  1. Guava 版本由两个 JARguava-19.0.jarguava-gwt-19.0.jar. 您将需要两者才能让 Guava 在您的 GWT 项目中工作。(在非 GWT 项目中,您只需要前者。)下载它们并将它们添加到您的项目中;如果您使用 Maven,请使用这些依赖项:

    <dependency>
        <groupId>com.google.guava</groupId>
        <artifactId>guava</artifactId>
        <version>19.0</version>
    </dependency>
    <dependency>
        <groupId>com.google.guava</groupId>
        <artifactId>guava-gwt</artifactId>
        <version>19.0</version>
    </dependency>
    

    然后 Maven 将自动从中央 Maven 存储库下载两个 Jars ,另请参阅mvnrepositories 上Guava 页面。作为SBT 用户,您会选择类似libraryDependencies += "com.google.guava" % "guava" % "19.0".

  2. 添加

      <inherits name="com.google.common.collect.Collect"/>
    

    到您的 GWT 模块文件以启用 Guava。

回答by Kevin Bourrillion

In the future, we'll release a working GWT module covering the @GwtCompatible subset of the library. Stay tuned.

将来,我们将发布一个工作 GWT 模块,涵盖库的 @GwtCompatible 子集。敬请关注。