Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/gwt/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 在集合上执行模式搜索和范围搜索时,使用GWT搜索番石榴2_Java_Gwt_Collections_Guava - Fatal编程技术网

Java 在集合上执行模式搜索和范围搜索时,使用GWT搜索番石榴2

Java 在集合上执行模式搜索和范围搜索时,使用GWT搜索番石榴2,java,gwt,collections,guava,Java,Gwt,Collections,Guava,我想在GWT应用程序中对Google Gauva集合执行搜索操作。 它们在独立应用程序中正常工作,但在GWT中它们正在生成 运行时问题。我正在显示EntryPoint类onModuleLoad的示例代码。 Iset guava-gwt-14.0.1.jar和guava-10.0.jar的构建路径 public void onModuleLoad() { List<String> sList=new ArrayList<String>(); sList.a

我想在GWT应用程序中对Google Gauva集合执行搜索操作。 它们在独立应用程序中正常工作,但在GWT中它们正在生成 运行时问题。我正在显示EntryPoint类onModuleLoad的示例代码。 Iset guava-gwt-14.0.1.jar和guava-10.0.jar的构建路径

public void onModuleLoad() {

    List<String> sList=new ArrayList<String>();
    sList.add("arun kumar");
    sList.add("ashok kumar");
    sList.add("ravi kumar");
    sList.add("kiran kumar");
    sList.add("rama");
    sList.add("ram");
    sList.add("rama krishna");
    sList.add("phani");
    sList.add("vikram");
    sList.add("veeru");
    sList.add("arjun");
    sList.add("naresh");


    //pattern matching
    Collection<String> filterdNamesKumar=Collections2.filter(sList, Predicates.containsPattern("kumar"));
    //starts with
    Collection<String> filterdNamesRam=Collections2.filter(sList, Predicates.containsPattern("^ram"));
    Collection<String> filterdNamesAr=Collections2.filter(sList, Predicates.containsPattern("^ar"));

    System.out.println(filterdNamesAr.toString());
    System.out.println(filterdNamesKumar.toString());
    System.out.println(filterdNamesRam.toString());

    Map<String,String> emps=new HashMap<String,String>();
    emps.put("emp1","01/02/2013");
    emps.put("emp2", "10/12/2013");
    emps.put("emp3","20/11/2013");
    emps.put("emp4", "25/09/2013");
    emps.put("emp5", "15/12/2013");
    emps.put("emp6", "20/08/2013");
    emps.put("emp7", "02/02/2012");

    for(String s:emps.keySet()){
        String strDate=emps.get(s);
        DateTimeFormat dateFormat=DateTimeFormat.getFormat("dd/MM/yyyy");
        Date empDate=dateFormat.parse(strDate);



            Date startDate=dateFormat.parse("01/11/2013");
            Date endDate=dateFormat.parse("31/12/2013");
            Range<Date> range=Ranges.closed(startDate, endDate);
            boolean b=range.apply(empDate);
            if(b){
                Window.alert("date found between boundaries");
            }

    }   

}
用@GwtIncompatible注释,这意味着它不在guava gwt中

顺便说一句,您应该对番石榴gwt和番石榴使用相同的版本。

用@GwtIncompatible注释,这意味着它不在番石榴gwt中

顺便说一句,您应该为guava gwt和guava使用相同的版本。

它是@gwtin兼容的,因为gwt不支持java.util.regex。它是@gwtin兼容的,因为gwt不支持java.util.regex。
[DEBUG] [googlegauva] - Validating newly compiled units
[TRACE] [googlegauva] - Finding entry point classes
    [ERROR] [googlegauva] - Errors in 'file:/D:/arun/eclipse_Myna/GoogleGauva/src/com/arun/gauva/client/GoogleGauva.java'
        [ERROR] [googlegauva] - Line 57: The method containsPattern(String) is undefined for the type Predicates
        [ERROR] [googlegauva] - Line 59: The method containsPattern(String) is undefined for the type Predicates
        [ERROR] [googlegauva] - Line 60: The method containsPattern(String) is undefined for the type Predicates
    [ERROR] [googlegauva] - Unable to find type 'com.arun.gauva.client.GoogleGauva'
        [ERROR] [googlegauva] - Hint: Previous compiler errors may have made this type unavailable
        [ERROR] [googlegauva] - Hint: Check the inheritance chain from your module; it may not be inheriting a required module or a module may not be adding its source path entries properly
[ERROR] [googlegauva] - Failed to load module 'googlegauva' from user agent 'Mozilla/5.0 (Windows NT 6.1; rv:5.0.1) Gecko/20100101 Firefox/5.0.1' at 127.0.0.1:52248
[DEBUG] [googlegauva] - Validating newly compiled units
[TRACE] [googlegauva] - Finding entry point classes
    [ERROR] [googlegauva] - Errors in 'file:/D:/arun/eclipse_Myna/GoogleGauva/src/com/arun/gauva/client/GoogleGauva.java'
        [ERROR] [googlegauva] - Line 57: The method containsPattern(String) is undefined for the type Predicates
        [ERROR] [googlegauva] - Line 59: The method containsPattern(String) is undefined for the type Predicates
        [ERROR] [googlegauva] - Line 60: The method containsPattern(String) is undefined for the type Predicates
    [ERROR] [googlegauva] - Unable to find type 'com.arun.gauva.client.GoogleGauva'
        [ERROR] [googlegauva] - Hint: Previous compiler errors may have made this type unavailable
        [ERROR] [googlegauva] - Hint: Check the inheritance chain from your module; it may not be inheriting a required module or a module may not be adding its source path entries properly
[ERROR] [googlegauva] - Failed to load module 'googlegauva' from user agent 'Mozilla/5.0 (Windows NT 6.1; rv:5.0.1) Gecko/20100101 Firefox/5.0.1' at 127.0.0.1:52251