小编Tan*_*ner的帖子

Twitter RSS API的替换?

我目前正在使用Twitter的RSS API(示例)来检索人们对应用的推文.但是,一旦他们的API 1.1版出来,我将无法再这样做了.我可以使用什么简单的替代品?

twitter google-apps-script

6
推荐指数
2
解决办法
4403
查看次数

使用XStream时ArrayIndexOutOfBoundsException

我不确定这是怎么回事,但我正在运行的程序给了我一个奇怪的错误.我在每个循环上得到一个ArrayIndexOutOfBoundsException:-1.整个错误如下:

Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: -1
at com.thoughtworks.xstream.core.util.OrderRetainingMap.entrySet(OrderRetainingMap.java:77)
at java.util.HashMap.putMapEntries(HashMap.java:511)
at java.util.HashMap.putAll(HashMap.java:784)
at com.thoughtworks.xstream.core.util.OrderRetainingMap.<init>(OrderRetainingMap.java:36)
at com.thoughtworks.xstream.converters.reflection.FieldDictionary.buildMap(FieldDictionary.java:135)
at com.thoughtworks.xstream.converters.reflection.FieldDictionary.fieldsFor(FieldDictionary.java:76)
at com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider.visitSerializableFields(PureJavaReflectionProvider.java:126)
at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doMarshal(AbstractReflectionConverter.java:81)
at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshal(AbstractReflectionConverter.java:72)
at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:43)
at com.thoughtworks.xstream.core.TreeMarshaller.start(TreeMarshaller.java:82)
at com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.marshal(AbstractTreeMarshallingStrategy.java:37)
at com.thoughtworks.xstream.XStream.marshal(XStream.java:895)
at com.thoughtworks.xstream.XStream.marshal(XStream.java:884)
at com.thoughtworks.xstream.XStream.toXML(XStream.java:857)
at com.thoughtworks.xstream.XStream.toXML(XStream.java:844)
at unl.cse.assignments.DataConverter.output(DataConverter.java:210)
at unl.cse.assignments.DataConverter.main(DataConverter.java:121)
Run Code Online (Sandbox Code Playgroud)

第210行是pw.print行:

for(Product p : products)
    {
        if(AwardTicket.class.isInstance(p)){
            xstream.alias("awardTicket", AwardTicket.class);
            pw.print(xstream.toXML(p) + "\n");
        }
}
Run Code Online (Sandbox Code Playgroud)

(第121行只调用输出)

我一直在调查这个错误很长一段时间,我无法弄清楚它的原因.我认为xstream有问题,但我尝试了其他输出.

java xml xstream

6
推荐指数
1
解决办法
1721
查看次数

布尔否定

我的一个考题是:

! ( ! ( a != b)  &&  ( b > 7 ) )
Run Code Online (Sandbox Code Playgroud)

选择:

a) (a != b) || (b < 7)
b) (a != b) || (b <= 7)
c) (a == b) || (b <= 7)
d) (a != b) && (b <= 7)
e) (a == b) && (b > 7)
Run Code Online (Sandbox Code Playgroud)

最初,我以为会是 D。这是不正确的,我明白为什么了。我不明白逻辑否定运算符如何反转 && 和大于/小于。我相信我已经将范围缩小到前两个。是否有任何实例 > 会更改为 <= ?

boolean-logic

2
推荐指数
1
解决办法
2134
查看次数

标签 统计

boolean-logic ×1

google-apps-script ×1

java ×1

twitter ×1

xml ×1

xstream ×1